/* строй.онлайн — дизайн-система */
/* Minimalism v1.0 tokens + Bootstrap override baseline */
:root {
    /* Brand + semantic */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #f97316;
    --secondary-dark: #ea580c;
    --accent: #10b981;
    --dark: #0f172a;
    --dark-soft: #1e293b;
    --light: #f1f5f9;
    --surface: #ffffff;
    --gray: #475569;
    --text-muted-accessible: #475569;
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --btn-radius: 999px;
    --box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --box-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);

    /* Typography */
    --font-text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-size-body: 16px;
    --line-height-body: 1.5;
    --font-size-caption: 14px;
    --font-weight-regular: 400;
    --font-weight-semibold: 600;

    /* 8px spacing scale */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 48px;

    /* Radius + borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --border-subtle: 1px solid #e5e7eb;

    /* iOS/Android notch & home indicator (requires viewport-fit=cover in base.html) */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

/* Bootstrap variable mapping (safe defaults for existing templates) */
:root {
    --bs-primary: var(--primary);
    --bs-body-color: var(--dark);
    --bs-body-font-family: var(--font-text);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius-md);
    --bs-border-color: #e5e7eb;
    --bs-secondary-color: var(--gray);
}

/* Minimal global component baseline */
.card {
    border-radius: var(--radius-md);
}

.card.border-0 {
    box-shadow: none !important;
}

.form-label {
    font-weight: var(--font-weight-semibold);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: var(--border-subtle);
    border-radius: var(--radius-sm);
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.btn {
    border-radius: 10px;
    font-weight: var(--font-weight-semibold);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-secondary {
    border-color: #d1d5db;
    color: #374151;
}

.btn-outline-secondary:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
    color: #111827;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn,
.form-control,
.form-select,
.form-check-input,
a.btn {
    min-height: 44px;
}

.table {
    --bs-table-striped-bg: #f9fafb;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 0.875rem;
}

.table thead th {
    font-size: var(--font-size-caption);
    color: var(--gray);
    font-weight: var(--font-weight-semibold);
}

.badge.bg-light.text-dark {
    background: #f3f4f6 !important;
    color: #374151 !important;
    font-weight: 600;
}

/* Reference flow visual rhythm */
.flow-screen-head h2,
.flow-screen-head h3 {
    font-weight: var(--font-weight-semibold);
    letter-spacing: -0.01em;
}

.flow-screen-head p {
    font-size: var(--font-size-caption);
}

.table-scroll .site-data-table {
    background: #fff;
}

@media (max-width: 767.98px) {
    .flow-screen-head {
        margin-bottom: var(--space-2);
    }
    .flow-screen-head h2 {
        font-size: 1.45rem;
    }
    .projects-page-toolbar,
    .tenders-hub-toolbar,
    .chats-page-toolbar {
        gap: 0.5rem !important;
    }
    .projects-page-toolbar .btn,
    .tenders-hub-toolbar .btn,
    .chats-page-toolbar .btn {
        width: 100%;
    }
}

.review-thumb, .chat-attachment-img {
    max-height: 120px;
    max-width: 200px;
    border-radius: 8px;
    object-fit: cover;
}
.review-video, .chat-attachment-video {
    max-width: 280px;
    max-height: 160px;
    border-radius: 8px;
}
.chat-messages {
    height: 400px;
    overflow-y: auto;
}

/* Тендеры — сравнение цен */
.tender-card {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.tender-card-header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-soft) 100%);
    color: #fff;
    border: none;
}
.tender-card-header .badge.bg-light {
    font-weight: 500;
}
.tender-price-range {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.95);
}
.tender-bids-table thead th {
    background: var(--light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray);
    border-bottom: 2px solid #e9ecef;
}
.tender-col-price {
    min-width: 7rem;
}
.tender-price-cell .tender-price-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}
.tender-row-best {
    background: rgba(42, 109, 255, 0.06);
}
.tender-row-best .tender-price-value {
    color: #1a5c2e;
}
.tender-detail-row td {
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem;
}
.bg-success-subtle {
    background: rgba(25, 135, 84, 0.12);
}
.page-back-nav .btn-back {
    min-width: 6.5rem;
}
.reselect-form textarea {
    max-width: 32rem;
}

.site-body {
    font-family: var(--font-text);
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* Фон: силуэты стройматериалов + светлая вуаль для читаемости текста */
.site-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("/static/images/bg-materials.svg");
    background-repeat: repeat;
    background-size: 300px 300px;
    pointer-events: none;
    z-index: -2;
}
.site-body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(248, 250, 252, 0.94) 0%,
        rgba(241, 245, 249, 0.96) 50%,
        rgba(248, 250, 252, 0.94) 100%
    );
    pointer-events: none;
    z-index: -1;
}
.site-main {
    flex: 1;
    position: relative;
    z-index: 0;
    overflow-x: hidden;
}

/* Изображения: не вылезают за экран, SVG/иконки с фикс. размером не ломаем */
.site-main img {
    max-width: 100%;
    height: auto;
}
.site-main img.role-icon,
.site-main img.feature-img,
.site-main .calc-card .card-header img,
.site-main .scope-card__icon img {
    max-width: none;
    height: auto;
}
.site-main .hero-visual-card > img {
    max-width: none;
    width: 100%;
}
.content-panel,
.card,
.list-group-item,
.table,
.alert:not(.alert-danger):not(.alert-success):not(.alert-warning) {
    background-color: var(--surface) !important;
    color: var(--dark);
}

/* Навигация */
.site-navbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.nav-notify-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: 0.15rem;
    padding: 0;
    border: none;
    color: #fff;
    text-decoration: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    transition: background 0.15s ease;
    cursor: pointer;
}
.nav-notify-bell:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.nav-notify-bell[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.22);
}
.nav-notify-bell__icon {
    font-size: 1.2rem;
    line-height: 1;
}
.notify-badge--bell {
    position: absolute;
    top: 2px;
    right: 0;
    font-size: 0.65rem;
    min-width: 1.1rem;
}
.nav-link-logout {
    margin-left: 0.35rem !important;
    padding: 0.4rem 0.85rem !important;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    opacity: 0.95;
}
.nav-link-logout:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
}
.project-photo-thumb {
    object-fit: cover;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 180px;
}
.project-photo-preview .project-photo-thumb {
    max-height: 72px;
}

/* Поле ввода чата */
.chat-compose-form {
    margin-bottom: 0;
}
.chat-compose {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.chat-compose-attach {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.chat-compose-attach:hover {
    color: var(--primary, #2a6dff);
    border-color: #cbd5e1;
}
.chat-compose-attach--active {
    color: var(--primary, #2a6dff);
    background: #eff6ff;
    border-color: #93c5fd;
}
.chat-compose-file {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}
.chat-compose-attach-icon {
    display: block;
}
.chat-compose-main {
    flex: 1;
    min-width: 0;
}
.chat-compose-input {
    resize: none;
    min-height: 44px;
    max-height: 120px;
    border-radius: 10px;
    border-color: #e2e8f0;
}
.chat-compose-file-hint {
    margin-top: 0.25rem;
    padding-left: 0.15rem;
}
.chat-compose-send {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.directory-card {
    transition: box-shadow 0.2s ease;
}
.directory-card:hover {
    box-shadow: var(--box-shadow);
}
.directory-filters {
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
}
.directory-role-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}
/* Кнопки «Кого ищете» — отдельные стили, без btn-outline-primary (конфликт hover) */
.directory-role-group .directory-role-btn {
    flex: 1 1 7.5rem;
    min-width: 0;
    max-width: 100%;
    border-radius: var(--btn-radius) !important;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    line-height: 1.25;
    justify-content: center;
    border-radius: 0.5rem !important;
    border: 2px solid var(--primary);
    background-color: #ffffff;
    color: #1e3a8a !important;
    box-shadow: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.directory-role-group .directory-role-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-dark);
    color: #1e3a8a !important;
    transform: none;
}
.directory-role-group .btn-check:focus + .directory-role-btn {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.35);
    color: #1e3a8a !important;
}
.directory-role-group .btn-check:checked + .directory-role-btn {
    background-color: var(--primary);
    border-color: var(--primary-dark);
    color: #ffffff !important;
}
.directory-role-group .btn-check:checked + .directory-role-btn:hover,
.directory-role-group .btn-check:checked + .directory-role-btn:focus {
    background-color: var(--primary-dark);
    border-color: #1e40af;
    color: #ffffff !important;
}
.directory-role-group .btn-check:active + .directory-role-btn {
    transform: none;
}
.directory-role-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-soft, #e8f0fe);
    color: var(--primary, #0d6efd);
}
.site-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(90deg, var(--dark) 0%, var(--dark-soft) 100%) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding-top: max(0.6rem, var(--safe-top));
    padding-bottom: 0.6rem;
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: -0.5px;
    color: white !important;
}
.navbar-brand .icon {
    flex-shrink: 0;
}

/* Логотип бренда: только белый (тёмный фон) или чёрный (светлый фон) */
.site-brand__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--brand-icon-color, #0f172a);
    line-height: 0;
}
.site-brand__icon svg {
    display: block;
    height: 2.35rem;
    width: auto;
}
.site-brand__icon--sm svg {
    height: 2rem;
}
.site-brand__icon--lg svg {
    height: 3.25rem;
}
.site-brand--navbar {
    display: inline-flex !important;
    align-items: center;
    gap: 0.6rem;
    padding: 0;
    text-decoration: none !important;
    --brand-icon-color: #fff;
}
.site-brand--navbar .site-brand__icon {
    color: #fff;
}
.site-brand--navbar .site-brand__icon svg,
.site-brand--navbar .site-brand__icon svg rect {
    fill: #fff;
    color: #fff;
}
.site-brand--navbar .site-brand__name {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    color: #fff !important;
    line-height: 1.1;
    white-space: nowrap;
}
.site-brand--footer {
    --brand-icon-color: #fff;
}
.site-brand--footer .site-brand__icon svg,
.site-brand--footer .site-brand__icon svg rect {
    fill: #fff;
    color: #fff;
}
.site-brand--footer .site-brand__link {
    color: #fff;
}
.site-brand--footer .site-brand__name {
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    letter-spacing: -0.02em;
}
.site-brand--footer .footer-tagline {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}
.site-brand--auth,
.site-brand--hero {
    --brand-icon-color: #0f172a;
}
.site-brand--auth .site-brand__icon,
.site-brand--hero .site-brand__icon {
    color: #0f172a;
}
.site-brand--auth .site-brand__icon svg,
.site-brand--auth .site-brand__icon svg rect,
.site-brand--hero .site-brand__icon svg,
.site-brand--hero .site-brand__icon svg rect {
    fill: #0f172a;
    color: #0f172a;
}
.site-brand--hero {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.site-brand--hero .site-brand__name--hero {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    color: var(--dark);
    line-height: 1.1;
}
.auth-visual--brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 1.75rem 1rem;
    background: linear-gradient(160deg, #f1f5f9 0%, #fff 70%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
}
.auth-visual--brand .site-brand--auth {
    margin-bottom: 0 !important;
}
.page-auth .auth-mobile-hero .site-brand--auth {
    margin-bottom: 0.75rem !important;
}
.nav-link-cta {
    background: var(--secondary) !important;
    border-radius: 999px !important;
    padding: 0.35rem 1rem !important;
    margin-left: 0.25rem;
    color: #fff !important;
}
.nav-link-cta:hover {
    background: var(--secondary-dark) !important;
    text-decoration: none !important;
}
.nav-link {
    font-weight: 500;
    color: rgba(255,255,255,0.85) !important;
    transition: 0.2s;
}
.nav-link:hover {
    color: white !important;
    text-decoration: underline;
}
.nav-user-block {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.65rem;
    line-height: 1.25;
    padding: 0;
    margin-left: 0;
}
.nav-link--profile {
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem !important;
}
.nav-link-support {
    white-space: nowrap;
}
@media (min-width: 992px) {
    .site-navbar-inner {
        flex-wrap: nowrap;
    }
    .site-navbar .navbar-collapse {
        flex: 1 1 auto;
    }
    .site-nav-links {
        flex-direction: row !important;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.3rem;
        width: 100%;
    }
    .site-nav-links .nav-user-block {
        margin-left: auto;
    }
}
.nav-user-block__profile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    max-width: 100%;
}
.nav-user-block__profile:hover .nav-user-block__name {
    text-decoration: underline;
}
.nav-user-block__profile .user-avatar {
    flex-shrink: 0;
}
.nav-user-block__name {
    color: #fff;
    font-weight: 600;
    font-size: 0.86rem;
    white-space: nowrap;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}
.nav-user-block__name:hover {
    color: #fff;
    text-decoration: underline;
}
.chat-bubble--pinned {
    border-left: 3px solid #f59e0b;
    padding-left: 0.5rem;
}
.chat-reply-quote {
    border-left: 2px solid rgba(0,0,0,0.15);
    padding-left: 0.5rem;
}
.chat-reply-quote--link {
    color: #475569;
    text-decoration: none;
    cursor: pointer;
}
.chat-reply-quote--link:hover {
    color: var(--primary, #2a6dff);
    text-decoration: underline;
}
.chat-pinned-link:hover {
    color: var(--primary, #2a6dff) !important;
}
.chat-bubble-inner {
    position: relative;
}
.chat-bubble-body {
    padding-right: 0.25rem;
}
.chat-msg-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    margin-top: 0.25rem;
    padding-top: 0.15rem;
}
.chat-forward-sheet {
    position: fixed;
    inset: 0;
    z-index: 11050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.chat-forward-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}
.chat-forward-sheet__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.chat-forward-list {
    max-height: 50vh;
    overflow-y: auto;
}
.chat-forward-item__title {
    line-height: 1.3;
}
.chat-forward-item__preview {
    margin-top: 0.2rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
body.chat-forward-open {
    overflow: hidden;
}
.chat-list-actions {
    margin-left: auto;
}
.chat-pin-btn--compact {
    font-size: 0.72rem;
    line-height: 1;
    min-width: 1.4rem;
    opacity: 0.7;
}
.chat-pin-btn--compact:hover,
.chat-pin-btn--active.chat-pin-btn--compact {
    opacity: 1;
}
.foreman-msg-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.25rem;
}
.foreman-pinned-strip {
    font-size: 0.85rem;
}
.tenders-hub-card {
    border: 1px solid #e2e8f0;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tenders-hub-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.tenders-hub-card--selected {
    border-color: #64748b;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.25);
}
.tenders-hub-card__title a {
    color: #0f172a;
}
.tenders-hub-card__title a:hover {
    color: var(--primary, #2a6dff);
}
.tenders-hub-card__price {
    color: #0f172a;
    font-size: 1.05rem;
}
#tenders-hub-page.tenders-hub-editing .tender-open-link {
    pointer-events: none;
}
.chat-msg-action-btn {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.75;
}
.chat-msg-action-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
    color: #334155;
}
.chat-bubble--highlight {
    animation: chat-highlight 1.5s ease;
}
@keyframes chat-highlight {
    0%, 30% { background-color: rgba(42, 109, 255, 0.12); }
    100% { background-color: transparent; }
}
.chat-thread-editing .chat-bubble {
    cursor: pointer;
}
.chat-bubble--selected {
    outline: 2px solid #94a3b8;
    outline-offset: 2px;
    border-radius: 6px;
}
#project-stages-page.project-stages-editing .table a:not(.stage-pick-link) {
    pointer-events: none;
    opacity: 0.7;
}
.foreman-msg-reply-btn {
    border: none;
    background: transparent;
    opacity: 0.65;
    font-size: 0.85rem;
    padding: 0 0.25rem;
    cursor: pointer;
}
.foreman-msg-reply-btn:hover {
    opacity: 1;
}
.btn-icon-action {
    min-width: 2.25rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    line-height: 1.2;
}

.btn-icon-action,
.projects-page-toolbar .btn-sm,
.tenders-hub-toolbar .btn-sm,
.chats-page-toolbar .btn-sm,
#stages-edit-toolbar .btn-sm,
#project-stages-page .btn-sm,
#tenders-edit-toolbar .btn-sm,
#projects-edit-toolbar .btn-sm,
#chats-edit-toolbar .btn-sm {
    min-height: 44px !important;
}

.btn-icon-action {
    min-width: 44px !important;
}
.nav-user-block__logout {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    margin-top: 0;
    padding: 0.35rem 0.5rem !important;
    white-space: nowrap;
}
.nav-user-block__logout:hover {
    color: #fff;
    text-decoration: underline;
}
@media (max-width: 991.98px) {
    .nav-user-block {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        width: 100%;
    }
    .nav-link--profile,
    .nav-user-block__logout {
        width: 100%;
        justify-content: flex-start;
    }
    .nav-user-block__name {
        max-width: none;
    }
}
.rating-stars {
    letter-spacing: 2px;
    color: #f5a623;
}
.portfolio-thumb {
    height: 180px;
    object-fit: cover;
}
/* Карточки */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.1);
}
.card-header {
    background: white;
    border-bottom: 1px solid #eef2f6;
    font-weight: 600;
    font-size: 1.25rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    padding: 1rem 1.25rem;
}
.card-body {
    padding: 1.5rem;
}

/* Кнопки — овальные (pill) */
.btn:not(.btn-close):not(.btn-link),
.btn-sm:not(.btn-close):not(.btn-link),
.btn-lg:not(.btn-close):not(.btn-link) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.35rem;
    line-height: 1.25;
    vertical-align: middle;
    border-radius: var(--btn-radius) !important;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.btn {
    padding: 0.5rem 1.25rem;
}
.btn-sm {
    padding: 0.35rem 1rem;
}
.btn-lg {
    padding: 0.65rem 1.75rem;
}
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary-dark);
    color: #ffffff !important;
    padding: 0.5rem 1.5rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    transition: all 0.2s;
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #ffffff !important;
    transform: translateY(-1px);
}
.btn-success {
    background-color: #059669;
    border-color: #047857;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}
.btn-success:hover {
    color: #ffffff !important;
    background-color: #047857;
}
.btn-warning {
    background-color: var(--secondary);
    border-color: var(--secondary-dark);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}
.btn-warning:hover {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
    color: #ffffff !important;
}
.btn-info {
    color: #ffffff !important;
}
.btn-outline-primary {
    background-color: #ffffff;
    color: var(--primary-dark) !important;
    border-width: 2px;
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background-color: var(--primary);
    color: #ffffff !important;
}
.btn-outline-secondary {
    background-color: #ffffff;
    color: var(--dark) !important;
    border-width: 2px;
    border-color: #94a3b8;
    font-weight: 600;
}
.btn-outline-secondary:hover {
    background-color: var(--dark-soft);
    border-color: var(--dark-soft);
    color: #ffffff !important;
}
.btn-back {
    background-color: #ffffff !important;
    color: var(--dark) !important;
}
.btn-link {
    font-weight: 600;
}

/* Прогресс-бары */
.progress {
    height: 12px;
    border-radius: 20px;
    background-color: #e9ecef;
}
.progress-bar {
    background-color: var(--primary);
    border-radius: 20px;
}
.progress-bar.bg-info {
    background-color: var(--secondary) !important;
}

/* Таблицы */
.table {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}
.table thead th {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: var(--dark);
}
.table tbody tr:hover {
    background-color: #f9fafb;
}
.table td, .table th {
    vertical-align: middle;
}

/* Формы */
.form-control, .form-select {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    transition: 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42, 109, 255, 0.1);
}

/* Главная — hero */
.hero-split {
    padding: 0.5rem 0 1rem;
}
.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.hero-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
}
.hero-badge--apt {
    background: #e0f2fe;
    color: #0369a1;
}
.hero-badge--house {
    background: #ffedd5;
    color: #c2410c;
}
.hero-checklist {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    max-width: 32rem;
}
.hero-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark-soft);
    font-size: 0.95rem;
}
.hero-check {
    flex-shrink: 0;
    display: inline-flex;
}
.hero-foreman-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding: 0.45rem 0.85rem;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
    border-radius: 999px;
    font-size: 0.88rem;
    color: #92400e;
    max-width: 100%;
}
.hero-foreman-chip__icon {
    font-size: 1.1rem;
    line-height: 1;
}
.hero-foreman-chip__text {
    line-height: 1.25;
}
.hero-foreman-chip[role="button"] {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.hero-foreman-chip[role="button"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}
.hero-foreman-chip[role="button"]:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}
a.hero-foreman-chip {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
a.hero-foreman-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
    color: #92400e;
}
a.hero-foreman-chip:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}
.calc-intro__note {
    font-size: 0.9rem;
}
.calc-tabs-wrap {
    width: 100%;
}
.calculator-section .calc-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.35rem;
    background: #e2e8f0;
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
.calculator-section .calc-tabs .nav-item {
    margin: 0;
}
.calculator-section .calc-tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0.55rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.25;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
/* Светлый фон — тёмный текст (неактивная вкладка) */
.calculator-section .calc-tab-btn:not(.active) {
    background-color: #ffffff;
    color: #0f172a;
    border-color: #94a3b8;
}
.calculator-section .calc-tab-btn:not(.active):hover {
    background-color: #f8fafc;
    color: #0f172a;
    border-color: #64748b;
}
/* Тёмный/цветной фон — светлый текст (активная вкладка) */
.calculator-section .calc-tab-btn.active,
.calculator-section .calc-tab-btn.active:hover {
    background-color: var(--primary);
    border-color: var(--primary-dark);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(42, 109, 255, 0.35);
}
.calc-tab-content {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}
.hero-visual-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}
.hero-visual-card {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    border: 3px solid var(--surface);
    aspect-ratio: 3 / 2;
    background: #e2e8f0;
}
.hero-visual-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.hero-visual-label {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
}
.platform-scope-lead {
    max-width: 36rem;
}
.scope-card {
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    border: 2px solid transparent;
    background: var(--surface);
}
.scope-card--apt {
    border-color: #bae6fd;
    background: linear-gradient(180deg, #f0f9ff 0%, #fff 40%);
}
.scope-card--house {
    border-color: #fed7aa;
    background: linear-gradient(180deg, #fff7ed 0%, #fff 40%);
}
.scope-card__icon {
    margin-bottom: 1rem;
}
.scope-card__icon img {
    display: block;
    width: 80px;
    height: 80px;
}
.scope-card .btn {
    min-height: 44px;
}
.scope-card h3 {
    font-weight: 800;
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}
.scope-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}
.scope-list li {
    padding: 0.35rem 0;
    font-size: 0.92rem;
    color: var(--dark-soft);
}
.ai-foreman-banner {
    background: linear-gradient(135deg, #fffbeb 0%, #eff6ff 55%, #f0fdf4 100%);
    border-radius: var(--border-radius-lg);
    padding: 1.75rem 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: var(--box-shadow-lg);
}
.ai-foreman-banner__img {
    max-width: min(160px, 55vw);
    width: 100%;
    height: auto;
    display: inline-block;
}
.ai-foreman-banner__badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}
.ai-foreman-banner__title {
    font-weight: 800;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    margin-bottom: 0.75rem;
    color: var(--dark);
}
.ai-foreman-banner__text {
    color: var(--gray);
    margin-bottom: 1rem;
    line-height: 1.55;
}
.ai-pill {
    display: block;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    color: var(--dark-soft);
}
.calc-card .card-header {
    font-weight: 700;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.calc-card .card-header img {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}
.calc-card .card-header span {
    flex: 1 1 12rem;
    min-width: 0;
}
.feature-card--highlight {
    border: 2px solid #fcd34d;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 50%);
}
.feature-emoji {
    display: flex;
    justify-content: center;
    margin: 0 auto 0.5rem;
}
.scope-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}
.scope-list .icon {
    flex-shrink: 0;
    margin-top: 0.15rem;
}
.hero-visual-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.ai-foreman-banner__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.calc-tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.35rem;
}
.ai-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    vertical-align: middle;
}
.btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
}
.hero-title {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--dark);
}
.hero-split--guest-focus .hero-title {
    font-size: clamp(2.25rem, 5.5vw, 3.25rem);
}
.hero-subtitle {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    margin: -0.25rem 0 0.75rem;
    max-width: 28rem;
    line-height: 1.35;
}
.hero-cta-row .hero-cta-primary {
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.ai-foreman-banner--teaser {
    border: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #fff 55%);
}
.hero-lead {
    font-size: 1.1rem;
    color: var(--gray);
    max-width: 32rem;
}
.hero-note {
    font-size: 0.9rem;
    color: var(--gray);
}
.roles-strip .role-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem 1rem;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}
.roles-strip .role-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-lg);
}
.role-icon {
    margin-bottom: 0.75rem;
}
.section-title {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--dark);
}
.features-grid .feature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.75rem 1.25rem;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s;
    border: 1px solid rgba(15, 23, 42, 0.04);
}
.features-grid .feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--box-shadow-lg);
}
.feature-card__media {
    width: 100%;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 0.75rem;
}
.feature-card__icon .icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary);
}
.feature-card__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}
.feature-card__text {
    width: 100%;
    font-size: 0.9rem;
    color: var(--gray);
    margin: 0;
    line-height: 1.45;
}
.feature-img {
    display: block;
    width: 72px;
    height: auto;
    max-width: 100%;
    max-height: 84px;
    object-fit: contain;
}
.feature-img--foreman {
    width: 72px;
    max-height: 84px;
}
.card-accent .card-header {
    background: linear-gradient(90deg, var(--primary-light), #fff);
    border-bottom: none;
}
.calc-result-box {
    background: var(--light);
    border-radius: 12px;
    padding: 1rem;
}

/* Auth pages */
.auth-panel {
    max-width: 420px;
    margin: 0 auto;
}
.auth-visual {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--box-shadow-lg);
    margin-bottom: 2rem;
}
.auth-visual img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Footer */
.site-footer {
    background: var(--dark);
    color: rgba(255, 255, 255, 0.75);
    margin-top: 3rem;
}
.site-footer strong {
    color: #fff;
}
.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    margin-left: 1.25rem;
    font-size: 0.9rem;
}
.site-footer-contacts {
    margin-top: 0.35rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}
.site-footer-contacts__label {
    margin-right: 0.35rem;
}
.footer-link:hover {
    color: #fff;
}

/* Dashboard welcome */
.page-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: #fff;
    border-radius: var(--border-radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow-lg);
}
.page-welcome h2 {
    font-weight: 800;
    margin-bottom: 0.25rem;
}
.page-welcome p {
    opacity: 0.9;
    margin: 0;
}
.project-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(15, 23, 42, 0.06);
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-lg);
}

.btn-group .btn {
    margin: 0 0.5rem;
    min-width: 160px;
}

/* Список чатов */
.list-group-item {
    border-radius: 12px !important;
    margin-bottom: 8px;
    border: 1px solid #edf2f7;
    transition: 0.2s;
}
.list-group-item:hover {
    background-color: #f8fafc;
    transform: translateX(4px);
}

/* Стили для чата */
.card-body .message {
    margin-bottom: 1rem;
}
.message-sent {
    background-color: var(--primary);
    color: white;
    padding: 8px 14px;
    border-radius: 18px;
    display: inline-block;
    max-width: 80%;
}
.message-received {
    background-color: #f1f5f9;
    color: var(--dark);
    padding: 8px 14px;
    border-radius: 18px;
    display: inline-block;
    max-width: 80%;
}

/* Бейджи статусов */
.badge {
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 40px;
}
.badge.bg-success {
    background-color: #10B981 !important;
}
.badge.bg-primary {
    background-color: var(--primary) !important;
}
.badge.bg-secondary {
    background-color: #94a3b8 !important;
}

/* Тип объекта на карточке проекта (контрастный текст, не «кнопка») */
.badge-object-type {
    display: inline-block;
    background: #e8eef7;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.8125rem;
    line-height: 1.4;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    letter-spacing: 0.02em;
    -webkit-font-smoothing: antialiased;
    white-space: nowrap;
}

/* ——— Мобильные и планшеты ——— */
.touch-target:not(.btn-close):not(.btn-link) {
    min-height: 48px;
}

.site-container {
    padding-left: max(1rem, var(--safe-left));
    padding-right: max(1rem, var(--safe-right));
}

/* Страницы входа / регистрации */
.page-auth .site-main {
    padding-bottom: env(safe-area-inset-bottom);
}
.auth-page {
    max-width: 720px;
    margin: 0 auto;
}
.auth-card {
    border-radius: var(--border-radius-lg);
}
.auth-email-mask {
    font-weight: 600;
    color: var(--text, #1e293b);
}
.auth-otp__cells {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}
.auth-otp__cell {
    width: 2.75rem;
    height: 3.25rem;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-radius: 12px;
    padding: 0;
}
@media (min-width: 400px) {
    .auth-otp__cell {
        width: 3rem;
        height: 3.5rem;
    }
}
.auth-form--otp .auth-otp__hint {
    text-align: center;
}
.auth-mobile-hero {
    text-align: center;
    margin-bottom: 1rem;
}
.auth-mobile-hero__img {
    border-radius: var(--border-radius);
    overflow: hidden;
    max-height: 140px;
    box-shadow: var(--box-shadow);
}
.auth-mobile-hero__img img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}
.auth-mobile-hero__text {
    font-size: 0.85rem;
    color: var(--gray);
    margin: 0.5rem 0 0;
}
.auth-role-icons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.role-pick-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}
@media (min-width: 400px) {
    .role-pick-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.role-pick {
    margin: 0;
    cursor: pointer;
}
.role-pick input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.role-pick__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    min-height: 88px;
    justify-content: center;
}
.role-pick--active .role-pick__box,
.role-pick input:checked + .role-pick__box {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}
.role-pick input:focus-visible + .role-pick__box {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Таблицы — горизонтальная прокрутка */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.table-scroll > .table {
    margin-bottom: 0;
    min-width: 560px;
}

/* Кнопка «Меню» на мобильных (светлая шапка) */
.site-nav-toggler {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.site-nav-toggler:hover,
.site-nav-toggler:focus {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.site-nav-toggler__icon {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 18px;
    height: 14px;
}
.site-nav-toggler__icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 1px;
}
.site-nav-toggler__label {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}
.site-nav-toggler[aria-expanded="true"] {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

/* Панели фильтров (как в админке) */
.site-list-filters {
    border: 1px solid #e2e8f0;
    box-shadow: var(--box-shadow);
}
.site-list-filters__hint {
    margin: 0;
}
.site-list-filters__grid .form-label {
    font-weight: 600;
    color: #64748b;
}
.site-sort-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.site-sort-bar__label {
    margin-right: 0.15rem;
}
.site-sort-bar__link {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid transparent;
}
.site-sort-bar__link:hover {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f172a;
}
.site-sort-bar__link--active {
    background: #111827;
    border-color: #111827;
    color: #fff !important;
}
.site-th-sort__link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.site-th-sort__link:hover {
    color: var(--primary, #2563eb);
    text-decoration: underline;
}
th.site-th-sort--active .site-th-sort__link {
    color: var(--primary, #2563eb);
}

/* Таблицы списков (единый стандарт) */
.site-table-wrap {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.site-data-table {
    margin-bottom: 0;
    font-size: 0.92rem;
}
.site-data-table thead th {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    white-space: nowrap;
}
.site-col-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: space-between;
}
.site-col-filter-btn {
    border: none;
    background: transparent;
    padding: 0;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    text-align: left;
}
.site-col-filter-btn:hover {
    color: var(--primary, #2563eb);
}
.site-col-filter-btn__badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--primary, #2563eb);
    color: #fff;
    border-radius: 999px;
    padding: 0 0.35rem;
    min-width: 1.1rem;
    text-align: center;
}
.site-col-sort-btn {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: #64748b;
    text-decoration: none;
    padding: 0 0.15rem;
}
.site-col-sort-btn:hover {
    color: var(--primary, #2563eb);
}
.site-col--filter-active .site-col-filter-btn {
    color: var(--primary, #2563eb);
}
.site-col-filter-popover {
    position: absolute;
    z-index: 1080;
    display: none;
}
.site-col-filter-popover--open {
    display: block;
}
.site-col-filter-popover__panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 0.65rem 0.75rem;
    min-width: 180px;
    max-width: 320px;
}
.site-col-filter-popover__title {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: #334155;
}
.site-col-filter-popover__options {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}
.site-col-filter-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    padding: 0.2rem 0;
    cursor: pointer;
    margin: 0;
}

.table-skeleton {
    display: grid;
    gap: 0.55rem;
}

.table-skeleton__row {
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: table-skeleton-shimmer 1.2s linear infinite;
}

@keyframes table-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.site-col-filter-popover__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.5rem;
}

.contractor-categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}
.contractor-cat-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin: 0;
}
.contractor-cat-pick input {
    margin: 0;
}

.tender-bulk-stage-row,
.project-stage-row {
    transition: background-color .15s ease, border-color .15s ease;
    cursor: pointer;
}

.tender-bulk-inline-pick,
.project-inline-pick {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    user-select: none;
}

.tender-bulk-inline-pick.is-selected,
.project-inline-pick.is-selected {
    border-color: color-mix(in srgb, var(--accent) 38%, #fff);
    background: color-mix(in srgb, var(--accent) 10%, #fff);
}

.directory-card.is-clickable,
.notification-row.is-clickable,
.tender-card.is-clickable {
    cursor: pointer;
    transition: box-shadow .15s ease, transform .15s ease;
}

.directory-card.is-clickable:hover,
.notification-row.is-clickable:hover,
.tender-card.is-clickable:hover {
    box-shadow: 0 10px 24px rgba(15, 23, 42, .1);
    transform: translateY(-1px);
}

.project-list-row,
.tenders-hub-row,
.site-clickable-row,
.chat-list-item {
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
}
.chat-list-item--unread {
    background-color: #eff6ff;
    box-shadow: inset 3px 0 0 #2a6dff;
}
.chat-list-item--unread:hover {
    background-color: #dbeafe;
}
.chat-list-title--unread {
    font-weight: 700;
    color: #0f172a;
}
.chat-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: #2a6dff;
    vertical-align: middle;
    flex-shrink: 0;
}
.chat-list-item--unread .chat-list-preview__text {
    font-weight: 500;
    color: #1e3a5f;
}
.chat-bubble--unread:not(.chat-bubble--mine) .chat-bubble-inner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
}
.nav-link--with-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.nav-chat-badge {
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    min-width: 1.1rem;
    padding: 0.15rem 0.35rem;
    border-radius: 999px;
    background: #2a6dff;
    color: #fff;
}

.project-list-row:hover,
.tenders-hub-row:hover,
.site-clickable-row:hover,
.chat-list-item:hover {
    background-color: #f8fafc;
}

/* Навигация (свёрнутое меню) */
@media (max-width: 991.98px) {
    .site-navbar .navbar-collapse {
        margin-top: 0.75rem;
        padding: 0.75rem 0 0.5rem;
        border-top: 1px solid #e2e8f0;
        background: #f8fafc;
        border-radius: 0 0 12px 12px;
    }
    .site-nav-links .nav-link {
        padding: 0.65rem 0.25rem !important;
        font-size: 1.05rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .site-nav-links .nav-link-cta {
        margin: 0.5rem 0 0 !important;
        justify-content: center;
        min-height: 48px;
    }
    .nav-user-block__name {
        max-width: none;
    }
    .site-navbar-inner {
        flex-wrap: nowrap;
    }
    .site-nav-toggler {
        flex-shrink: 0;
        min-height: 44px;
    }
    .nav-notify-bell {
        flex-shrink: 0;
    }
}

@media (max-width: 767.98px) {
    .hero-title {
        font-size: 1.75rem;
    }
    .hero-lead {
        font-size: 1rem;
    }
    .hero-split .btn-lg {
        width: 100%;
    }
    .hero-badges {
        justify-content: flex-start;
    }
    .hero-visual-duo {
        grid-template-columns: 1fr 1fr;
        max-width: none;
        gap: 0.5rem;
    }
    .scope-card {
        padding: 1.15rem;
    }
    .scope-card h3 {
        font-size: 1.2rem;
    }
    .ai-foreman-banner {
        padding: 1.25rem 1rem;
    }
    .ai-foreman-banner__title {
        font-size: 1.35rem;
    }
    .ai-foreman-pills .col-sm-6 {
        flex: 0 0 50%;
    }
    .calculator-section .calc-tabs {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        border-radius: 1.25rem;
    }
    .calculator-section .calc-tab-btn {
        width: 100%;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .features-grid .col-md-6 {
        flex: 0 0 100%;
    }
    .btn-group,
    .btn-group-vertical {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    .btn-group .btn {
        width: 100%;
        margin: 0;
        min-width: 0;
    }
    .navbar-brand {
        font-size: 1.2rem;
    }
    .site-brand--navbar .site-brand__name {
        font-size: 1.1rem;
    }
    .site-brand--navbar .site-brand__name {
        font-size: 1.1rem;
    }
    .site-brand--navbar .site-brand__icon svg {
        height: 2rem;
    }
    .page-welcome {
        padding: 1.25rem 1rem;
        border-radius: var(--border-radius);
    }
    .page-welcome h2 {
        font-size: 1.35rem;
    }
    .card-body {
        padding: 1rem;
    }
    .card:hover,
    .project-card:hover,
    .roles-strip .role-card:hover,
    .features-grid .feature-card:hover {
        transform: none;
    }
    .form-control,
    .form-select,
    .form-control-lg {
        font-size: 16px;
        min-height: 48px;
    }
    textarea.form-control {
        min-height: auto;
    }
    .table {
        font-size: 0.85rem;
    }
    .table td .btn-sm {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
        min-height: 36px;
    }
    .page-back-nav .btn-back {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }
    .site-footer {
        margin-top: 2rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    .footer-tagline {
        display: block;
        margin-top: 0.25rem;
        font-size: 0.85rem;
        opacity: 0.75;
    }
    .footer-link {
        display: inline-block;
        margin: 0.35rem 0.75rem;
        padding: 0.35rem 0;
        min-height: 44px;
        line-height: 2;
    }
    .chat-messages {
        height: min(55vh, 400px);
    }
    .support-chat-page {
        min-height: calc(100dvh - 9rem);
    }
    .message-sent,
    .message-received {
        max-width: 92%;
    }
    .review-thumb,
    .chat-attachment-img {
        max-width: 100%;
    }
    .assistant-hero {
        flex-direction: column;
        text-align: center;
    }
    .assistant-chat-card .assistant-messages {
        max-height: 50vh;
    }
    .foreman-fab-label {
        display: none;
    }
    .foreman-fab {
        padding: 0.5rem;
        min-width: 56px;
        min-height: 56px;
        justify-content: center;
    }
    .foreman-panel {
        width: min(100vw - 1.5rem, 360px);
        right: 0;
        left: auto;
        max-height: min(75vh, 520px);
    }
    .d-flex.flex-wrap.gap-2 .btn:not(.btn-sm),
    .d-flex.flex-wrap.gap-3 .btn:not(.btn-sm) {
        flex: 1 1 100%;
    }
    .mobile-data-card-list .d-flex.flex-wrap .btn-sm,
    .mobile-data-card .d-flex.flex-wrap .btn-sm,
    .mobile-stage-actions .btn-sm {
        flex: 0 1 auto;
        width: auto;
        min-width: 0;
        max-width: 100%;
    }
    .project-detail-actions .btn {
        width: 100%;
    }
    .auth-select-card .btn {
        width: 100%;
        min-height: 48px;
    }
}

@media (max-width: 575.98px) {
    .hero-visual-duo {
        grid-template-columns: 1fr;
    }
    .roles-strip .col-md-4 {
        flex: 0 0 100%;
    }
    .features-grid .col-md-3,
    .features-grid .col-lg-4 {
        flex: 0 0 100%;
    }
    .ai-foreman-pills > [class*="col-"] {
        flex: 0 0 100%;
    }
    .tender-price-cell .tender-price-value {
        font-size: 1.05rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn-primary:hover,
    .btn-outline-primary:hover {
        transform: none;
    }
}

/* Дополнительные утилиты */
.shadow-sm {
    box-shadow: var(--box-shadow);
}
.rounded-3 {
    border-radius: var(--border-radius);
}
.bg-light {
    background-color: #f8fafc !important;
}

.notify-badge {
    position: absolute;
    top: 2px;
    right: -6px;
    background: var(--secondary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
}

/* Панель уведомлений */
body.notify-drawer-open {
    overflow: hidden;
}
.notify-drawer {
    pointer-events: none;
    visibility: hidden;
    position: fixed;
    inset: 0;
    z-index: 1060;
}
.notify-drawer--open {
    pointer-events: auto;
    visibility: visible;
}
.notify-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.notify-drawer--open .notify-drawer__backdrop {
    opacity: 1;
}
.notify-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(380px, 100vw);
    height: 100%;
    max-height: 100dvh;
    background: #fff;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.notify-drawer--open .notify-drawer__panel {
    transform: translateX(0);
}
.notify-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(1rem, var(--safe-top)) max(1rem, var(--safe-right)) 0.5rem max(1rem, var(--safe-left));
    border-bottom: 1px solid #e2e8f0;
}
.notify-drawer__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}
.notify-drawer__toolbar {
    padding: 0.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.notify-drawer__subtitle {
    margin-top: 0.15rem;
}
.notify-drawer__feedback {
    padding: 0 1rem 0.25rem;
}
.notify-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.75rem 1rem;
}
.notify-item {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
}
.notify-item--unread {
    background: #fffbeb;
    border-color: #fde68a;
}
.notify-item__main {
    flex: 1;
    min-width: 0;
}
.notify-item__title {
    display: block;
    font-size: 0.92rem;
}
.notify-item__body {
    margin: 0.25rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
}
.notify-item__time {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #94a3b8;
}
.notify-item__actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* ИИ-прораб */
.assistant-page {
    max-width: 1100px;
    margin: 0 auto;
}
.assistant-hero {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #fffbeb 0%, #eff6ff 100%);
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
}
.assistant-avatar-wrap {
    flex-shrink: 0;
    background: #fff;
    border-radius: 50%;
    padding: 0.5rem;
    box-shadow: var(--box-shadow);
}
.assistant-chat-card .assistant-messages {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.assistant-msg {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.assistant-msg-user {
    justify-content: flex-end;
}
.assistant-msg-user .assistant-bubble {
    background: #2563eb;
    color: #fff;
    border-radius: 1rem 1rem 0.25rem 1rem;
}
.assistant-msg-assistant .assistant-bubble {
    background: #f1f5f9;
    color: #0f172a;
    border-radius: 1rem 1rem 1rem 0.25rem;
    border: 1px solid #e2e8f0;
}
.assistant-bubble {
    padding: 0.65rem 0.9rem;
    max-width: 92%;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.assistant-msg-avatar {
    flex-shrink: 0;
    line-height: 0;
}
.foreman-icon {
    display: block;
    flex-shrink: 0;
}

/* Плавающий виджет прораба */
.foreman-widget-root {
    position: fixed;
    z-index: 1050;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    font-family: inherit;
    touch-action: none;
}
.foreman-widget-root--placed {
    right: auto;
    bottom: auto;
}
.foreman-widget-root--dragging .foreman-fab {
    cursor: grabbing;
}
.foreman-fab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #1e293b;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.45);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    touch-action: none;
    user-select: none;
}
.foreman-widget-root:not(.foreman-widget-root--dragging) .foreman-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(245, 158, 11, 0.5);
}
.foreman-fab-icon {
    display: flex;
    background: #fff;
    border-radius: 50%;
    padding: 2px;
    line-height: 0;
}
.foreman-fab-label {
    font-weight: 700;
    font-size: 0.9rem;
}
.foreman-panel {
    display: none;
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    width: min(360px, calc(100vw - 2rem));
    max-height: min(520px, 70vh);
    flex-direction: column;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.foreman-panel.foreman-panel-open {
    display: flex;
}
.foreman-panel.foreman-panel--below {
    bottom: auto;
    top: calc(100% + 0.75rem);
}
.foreman-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: #fff;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.foreman-panel-header .btn-close {
    cursor: pointer;
}
.foreman-panel-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.foreman-panel-sub {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
}
.foreman-panel-alert {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    background: #fffbeb;
    color: #92400e;
}
.foreman-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 120px;
    max-height: 280px;
}
.foreman-msg {
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
}
.foreman-msg-user {
    justify-content: flex-end;
}
.foreman-msg-body {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    min-width: 0;
}
.foreman-msg-assistant .foreman-msg-body {
    align-items: flex-start;
}
.foreman-msg-body--user {
    align-items: flex-end;
}
.foreman-msg-meta {
    margin-bottom: 0.2rem;
    line-height: 1.3;
}
.foreman-msg-body--user .foreman-msg-meta {
    text-align: right;
}
.foreman-msg-assistant .foreman-bubble,
.foreman-msg-body .foreman-bubble {
    max-width: 100%;
}
.foreman-msg-user .foreman-bubble {
    background: #2563eb;
    color: #fff;
    border-radius: 1rem 1rem 0.2rem 1rem;
}
.foreman-msg-assistant .foreman-bubble {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1rem 1rem 1rem 0.2rem;
}
.foreman-bubble {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 88%;
    white-space: pre-wrap;
    word-break: break-word;
}
.foreman-msg-avatar {
    flex-shrink: 0;
    line-height: 0;
}
.foreman-msg-foot {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding: 0;
}
.foreman-msg-assistant .foreman-msg-foot {
    justify-content: space-between;
}
.foreman-msg-body--user .foreman-msg-foot {
    justify-content: flex-end;
}
.foreman-msg-time {
    font-size: 0.72rem;
    color: #64748b;
    flex-shrink: 0;
}
.foreman-msg-feedback {
    display: inline-flex;
    gap: 0.15rem;
    margin-left: auto;
    flex-shrink: 0;
}
.foreman-feedback-btn {
    border: none;
    background: transparent;
    padding: 0 0.2rem;
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.55;
    cursor: pointer;
}
.foreman-feedback-btn:hover,
.foreman-feedback-btn--active {
    opacity: 1;
}
.foreman-guest-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid var(--border, #e2e8f0);
    margin-top: 0.35rem;
    padding-top: 0.65rem;
}
.foreman-guest-cta .btn {
    flex: 1 1 auto;
    min-width: 7rem;
}
.foreman-panel-form {
    padding: 0.75rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.foreman-draft-in-chat {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}
.foreman-draft-in-chat__title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #0c4a6e;
}
.foreman-draft-in-chat__params {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 0.75rem;
    margin: 0 0 0.5rem;
}
.foreman-draft-in-chat__params dt {
    margin: 0;
    color: #64748b;
    font-weight: 500;
}
.foreman-draft-in-chat__params dd {
    margin: 0;
    color: #0f172a;
}
.foreman-draft-in-chat__section-title,
.foreman-draft-in-chat__stages-title {
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.35rem;
    color: #334155;
}
.foreman-draft-in-chat__label {
    font-size: 0.8125rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    display: block;
}
.foreman-draft-stage-row,
.foreman-draft-file-row {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
}
.foreman-draft-in-chat__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.foreman-draft-in-chat__budget {
    color: #0f766e;
    font-size: 0.8125rem;
}
.foreman-draft-in-chat__stages {
    margin: 0 0 0.5rem;
    padding-left: 1.1rem;
    color: #1e293b;
}
.foreman-draft-in-chat__dates {
    color: #64748b;
    font-size: 0.8125rem;
}
.foreman-draft-in-chat__hint {
    font-size: 0.8125rem;
    margin-top: 0.35rem;
}
.foreman-draft-card {
    margin: 0 0.75rem 0.5rem;
    padding: 0.65rem 0.75rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
}
.foreman-draft-summary {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
}
.foreman-draft-stages-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.foreman-draft-stage-row {
    display: grid;
    grid-template-columns: 1fr minmax(7rem, 8.5rem) minmax(7rem, 8.5rem) auto;
    gap: 0.35rem;
    align-items: center;
}
.foreman-draft-stage-name {
    line-height: 1.2;
}
.foreman-add-stage-select {
    min-width: 10rem;
    max-width: 100%;
}
.foreman-add-custom-stage {
    min-width: 10rem;
    flex: 1;
}
.foreman-wizard-bar .btn-link {
    color: #64748b;
    text-decoration: none;
}
.prorab-side-card--muted {
    opacity: 1 !important;
    border-style: dashed;
    border-color: #cbd5e1;
    background: #f8fafc;
}
.prorab-side-card--muted .card-header {
    color: #64748b;
}
.foreman-attachments {
    list-style: none;
    margin: 0.35rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.foreman-attachment {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
}
.foreman-attachment__name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}
.foreman-attachment__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.foreman-attachment__status {
    font-size: 0.72rem;
    color: #64748b;
}
.foreman-attachment__remove {
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 0.72rem;
    line-height: 1.2;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}
.foreman-attachment__remove:hover {
    color: #dc2626;
}
.foreman-attachment__progress {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: 0.25rem;
    overflow: hidden;
}
.foreman-attachment__bar {
    height: 100%;
    background: #f59e0b;
    border-radius: 2px;
    transition: width 0.15s ease;
}
.foreman-attachment--done .foreman-attachment__bar {
    background: #22c55e;
}
.foreman-attachment--error .foreman-attachment__bar {
    background: #ef4444;
}
.foreman-upload-busy {
    margin-top: 0.25rem;
}
.foreman-msg--thinking .foreman-bubble {
    background: #f1f5f9;
    min-width: 3.5rem;
}
.foreman-thinking-status {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.35rem;
}
@media (max-width: 768px) {
    .foreman-compose-hint__desk,
    .compose-enter-hint__desk {
        display: none;
    }
}
.foreman-upload-busy:not(.d-none) + .foreman-compose-hint,
.foreman-attachments:not(.d-none) ~ .foreman-file-hint {
    margin-top: 0.25rem;
}
.foreman-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.15rem 0;
}
.foreman-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: foreman-typing-bounce 1.2s infinite ease-in-out;
}
.foreman-typing span:nth-child(2) {
    animation-delay: 0.15s;
}
.foreman-typing span:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes foreman-typing-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}
.foreman-widget-root--page {
    position: relative;
    width: 100%;
    z-index: auto;
    touch-action: auto;
}
.assistant-page .assistant-chat-card {
    position: relative;
    z-index: 2;
}
.assistant-page .col-lg-5 {
    position: relative;
    z-index: 3;
}
.foreman-widget-root--page .foreman-fab {
    display: none;
}
.foreman-panel--page {
    position: static;
    display: flex !important;
    flex-direction: column;
    width: 100%;
    max-width: none;
    max-height: none;
    box-shadow: none;
    border: none;
    transform: none !important;
}
.foreman-messages--page {
    min-height: 280px;
    max-height: 420px;
}
/* Страница /chat/mikhalych — полноценный диалог (как /chat/{id}) */
.page-mikhalych-chat .mikhalych-thread-page {
    max-width: 52rem;
    margin: 0 auto;
}
.page-mikhalych-chat .mikhalych-thread-card {
    display: flex;
    flex-direction: column;
    height: min(78dvh, calc(100dvh - 9.5rem));
    max-height: min(78dvh, calc(100dvh - 9.5rem));
    min-height: 20rem;
    border-radius: var(--border-radius, 0.75rem);
    overflow: hidden;
}
.page-mikhalych-chat .foreman-widget-root--thread {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    position: static;
    z-index: auto;
}
.page-mikhalych-chat .foreman-thread-header {
    flex-shrink: 0;
    padding: 1rem 1.15rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}
.page-mikhalych-chat .foreman-thread-header .chat-thread-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}
.page-mikhalych-chat .foreman-pinned-strip {
    flex-shrink: 0;
}
.page-mikhalych-chat .foreman-wizard-bar {
    flex-shrink: 0;
    background: #f0f9ff;
    border-bottom: 1px solid #bae6fd;
    padding-left: 1rem;
    padding-right: 1rem;
}
.page-mikhalych-chat .foreman-wizard-bar__label {
    font-weight: 500;
}
.foreman-task-panel {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem 0.5rem;
    background: linear-gradient(180deg, #fff7ed 0%, #fffaf4 100%);
    border-bottom: 1px solid #fed7aa;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.foreman-task-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.foreman-task-panel__title {
    font-weight: 600;
    color: #7c2d12;
    font-size: 0.9rem;
    line-height: 1.2;
}
.foreman-task-panel__goal,
.foreman-task-panel__summary {
    color: #9a3412;
    font-size: 0.78rem;
    line-height: 1.25;
}
.foreman-task-panel__goal {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}
.foreman-task-panel__summary {
    margin-top: 0.18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.foreman-task-panel__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}
.foreman-task-panel__chip {
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #475569;
    padding: 0.15rem 0.5rem;
    font-size: 0.74rem;
}
.foreman-task-panel__chip.is-active {
    border-color: rgba(245, 158, 11, 0.55);
    background: rgba(254, 243, 199, 0.9);
    color: #92400e;
    font-weight: 700;
}
.foreman-task-panel__head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.foreman-task-panel__toggle {
    border: 0;
    background: transparent;
    color: #9a3412;
    font-size: 0.75rem;
    padding: 0.15rem 0.25rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.foreman-task-panel__details {
    margin-top: 0.45rem;
}
.foreman-task-panel__steps {
    display: flex;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
}
.foreman-task-panel__steps li {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 0 0 auto;
    padding: 0.26rem 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.65);
    color: #64748b;
    font-size: 0.75rem;
}
.foreman-task-panel__steps li.is-done {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(220, 252, 231, 0.65);
    color: #166534;
}
.foreman-task-panel__step-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    font-size: 0.75rem;
    font-weight: 700;
}
.foreman-task-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.38rem;
}
.foreman-task-panel__actions .btn {
    padding: 0.18rem 0.55rem;
    font-size: 0.78rem;
}
.foreman-task-panel__history {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.4rem;
    color: #475569;
    font-size: 0.8rem;
}
.foreman-task-panel__history-row {
    padding-left: 0.6rem;
    border-left: 2px solid rgba(245, 158, 11, 0.45);
}
.foreman-task-panel__status {
    flex-shrink: 0;
    border-radius: 999px;
    background: #ffedd5;
    color: #9a3412;
    font-size: 0.7rem;
    padding: 0.15rem 0.48rem;
    white-space: nowrap;
}
.page-mikhalych-chat .foreman-messages--thread {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1rem 1.15rem 0.75rem;
    background: #f1f5f9;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
.page-mikhalych-chat .foreman-thread-compose {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 0.65rem 1rem 0.75rem;
}
.page-mikhalych-chat .foreman-panel-form--thread {
    padding: 0;
    border: none;
    background: transparent;
}
.page-mikhalych-chat .foreman-reply-bar {
    margin: 0 0 0.5rem;
    border-radius: 0.5rem;
}
.page-mikhalych-chat .foreman-msg {
    margin-bottom: 0.75rem;
}
.page-mikhalych-chat .foreman-msg-user .foreman-bubble {
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}
.foreman-chat-photo {
    display: block;
    max-width: min(280px, 100%);
    max-height: 320px;
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    object-fit: contain;
}
.foreman-msg-user .foreman-bubble .foreman-chat-photo {
    margin-bottom: 0.25rem;
}
.foreman-chat-photo-caption {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}
.foreman-attachment--photo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.foreman-attachment__thumb {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: cover;
    border-radius: 0.35rem;
    flex-shrink: 0;
}
.page-mikhalych-chat .foreman-msg-assistant .foreman-bubble {
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.page-mikhalych-chat .foreman-compose {
    align-items: flex-end;
    gap: 0.5rem;
}
.page-mikhalych-chat .foreman-compose-input {
    min-height: 2.75rem;
    max-height: 8rem;
    border-radius: 1.25rem;
    padding: 0.55rem 1rem;
    border-color: #cbd5e1;
    background: #f8fafc;
}
.page-mikhalych-chat .foreman-compose-input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.page-mikhalych-chat .foreman-compose-send {
    border-radius: 50%;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    flex-shrink: 0;
}
.page-mikhalych-chat .foreman-compose-attach {
    margin-bottom: 0.15rem;
}
.page-mikhalych-chat .foreman-msg-foot--compact {
    gap: 0.35rem;
}
.page-mikhalych-chat .foreman-msg-foot--compact .foreman-msg-time {
    order: 2;
    margin-left: auto;
}
.page-mikhalych-chat .foreman-msg-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: nowrap;
}
.page-mikhalych-chat .foreman-msg-foot--compact .foreman-msg-feedback {
    margin-left: 0;
}
.page-mikhalych-chat .foreman-msg-body {
    max-width: min(92%, 28rem);
}
.page-mikhalych-chat .foreman-msg-user .foreman-msg-body {
    max-width: min(88%, 26rem);
}
@media (max-width: 767.98px) {
    .page-mikhalych-chat .mikhalych-thread-card {
        min-height: calc(100dvh - 8.5rem);
        border-radius: 0.65rem;
    }
    .page-mikhalych-chat .foreman-msg-foot--compact .chat-msg-action-btn[data-action="forward"],
    .page-mikhalych-chat .foreman-msg-foot--compact .chat-msg-action-btn[data-action="pin"],
    .page-mikhalych-chat .foreman-msg-foot--compact .foreman-msg-feedback {
        display: none;
    }
    .page-mikhalych-chat .foreman-compose-hint__desk {
        display: none;
    }
}
/* Встроенный виджет (assistant и т.п.) — прежний компактный режим */
.page-mikhalych-chat .foreman-messages--page,
.foreman-messages--page:not(.foreman-messages--thread) {
    min-height: min(50vh, 360px);
    max-height: min(62vh, 520px);
}
/* Гостевой Михалыч на главной — минимализм в духе giga.chat */
.guest-mikhalych-home__shell {
    max-width: 100%;
    margin: 0 auto;
}
.guest-mikhalych-home--fullbleed {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: clamp(0.9rem, 4vw, 2.5rem);
    padding-right: clamp(0.9rem, 4vw, 2.5rem);
}
.guest-mikhalych-home__head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.guest-mikhalych-home__title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0f172a;
}
.guest-mikhalych-home__sub {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.15rem;
}
.guest-mikhalych-home__intro {
    margin: 0 0 0.9rem;
    color: #475569;
    font-size: 0.93rem;
    line-height: 1.45;
}
.guest-mikhalych-home__alert {
    margin-bottom: 0.75rem;
    border-radius: 0.75rem;
}
.guest-mikhalych-home__card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 1.8rem;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    width: 100%;
}
.guest-mikhalych-home .foreman-panel--guest-giga {
    background: #fff;
}
.guest-mikhalych-home .foreman-messages--page {
    min-height: 200px;
    max-height: min(52vh, 420px);
    padding: 1.25rem 1.25rem 0.75rem;
    background: #fbfbfc;
    gap: 0.85rem;
}
.guest-mikhalych-home .foreman-msg-assistant .foreman-bubble {
    background: #fff;
    border: 1px solid #eceef1;
    border-radius: 1.35rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #1e293b;
    max-width: 100%;
}
.guest-mikhalych-home .foreman-msg-user .foreman-bubble {
    border-radius: 1.35rem 1.35rem 0.5rem 1.35rem;
    padding: 0.65rem 1rem;
    font-size: 0.9375rem;
}
.foreman-panel-form--guest-giga {
    padding: 1rem 1.1rem 1.1rem;
    border-top: none;
    background: #fff;
    margin-top: 0.55rem;
}
.guest-giga-compose {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    border-left: 1px solid #eef2f7;
}
.guest-giga-compose__field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: 0.5rem;
    row-gap: 0;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 2rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.guest-giga-compose__field:focus-within {
    background: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.guest-giga-compose__input {
    width: 100%;
    min-width: 0;
    min-height: 2.5rem;
    max-height: 8.5rem;
    margin: 0;
    padding: 0.55rem 0 0.55rem 0;
    border: none;
    background: transparent;
    box-shadow: none;
    resize: none;
    font-size: 1rem;
    line-height: 1.45;
    color: #0f172a;
}
.guest-giga-compose__input:focus {
    outline: none;
    box-shadow: none;
}
.guest-giga-compose__input::placeholder {
    color: #94a3b8;
}
.guest-giga-compose__send {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.guest-giga-compose__send:hover:not(:disabled) {
    background: #1d4ed8;
}
.guest-giga-compose__send:active:not(:disabled) {
    transform: scale(0.96);
}
.guest-giga-compose__send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.guest-giga-compose__hint {
    margin: 0;
    padding: 0 0.35rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #94a3b8;
    text-align: center;
}
@media (max-width: 380px) {
    .guest-giga-compose__field {
        padding-left: 0.85rem;
    }
    .guest-giga-compose__send {
        width: 2.35rem;
        height: 2.35rem;
    }
    .guest-giga-compose {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }
}
.foreman-panel-form--page {
    border-top: 1px solid #e2e8f0;
}
.foreman-compose {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}
.foreman-compose-main {
    flex: 1;
    min-width: 0;
}
.foreman-compose-input {
    resize: none;
}
.foreman-compose-attach {
    margin-bottom: 0.25rem;
}
.foreman-compose-send {
    flex-shrink: 0;
    min-width: 2.5rem;
}

/* Ответы ИИ без сырого Markdown */
.ai-rich-text p {
    margin: 0 0 0.45em;
}
.ai-rich-text p:last-child {
    margin-bottom: 0;
}
.ai-rich-text .ai-heading {
    margin-top: 0.35em;
}
.ai-rich-text ul.ai-list {
    margin: 0.35em 0 0.5em;
    padding-left: 1.15rem;
}
.ai-rich-text li {
    margin-bottom: 0.2em;
}
.ai-rich-text code {
    font-size: 0.88em;
    background: #e2e8f0;
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.ai-rich-text pre.ai-code {
    font-size: 0.8em;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    margin: 0.35em 0;
}
.ai-rich-text a {
    color: #2563eb;
    text-decoration: underline;
}
.assistant-bubble.ai-rich-text {
    white-space: normal;
}

/* Аватары и чаты */
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}
.user-avatar--img {
    object-fit: cover;
    border: 2px solid #e2e8f0;
}
.avatar-picker__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.avatar-picker__item {
    cursor: pointer;
    margin: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.avatar-picker__item:has(.avatar-picker__input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.avatar-picker__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.avatar-picker__item img {
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--light);
}

.user-avatar--placeholder {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    font-weight: 700;
    line-height: 1;
}
.chat-sender-role {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    margin-left: 0.35rem;
}
.chat-list-title {
    line-height: 1.3;
}
.chat-list-preview {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-list-preview__who {
    font-weight: 600;
    color: #475569;
    margin-right: 0.2rem;
}
.chats-editing .chat-list-item {
    cursor: pointer;
}
.chats-editing .chat-list-item--selected {
    background: #f0f7ff;
}
.chats-editing .chat-pick {
    cursor: pointer;
}
.projects-editing .project-list-card {
    cursor: pointer;
}
.projects-editing .project-list-card--selected {
    outline: 2px solid #2A6DFF;
    outline-offset: 2px;
}
.chat-list-item {
    transition: background-color 0.15s ease;
}
.chat-pin-btn {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
    text-decoration: none;
    opacity: 0.45;
}
.chat-pin-btn--active,
.chat-pin-btn[aria-pressed="true"] {
    opacity: 1;
}
.foreman-choice-btns {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}
.foreman-choice-btns .btn {
    text-align: left;
    white-space: normal;
}
.chat-list-item:hover {
    background-color: #f8fafc;
}
.chat-thread-name {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}
.chat-thread-name:hover {
    color: var(--primary, #2a6dff);
}
.chat-bubble-head {
    margin-bottom: 0.25rem;
}
.chat-sender-name {
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
}
.chat-sender-name:hover {
    color: var(--primary, #2a6dff);
}
.chat-bubble--mine {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    margin-left: 1.5rem;
}
.chat-thread-header {
    padding: 0.85rem 1rem;
}
.page-support-chat .site-main > .site-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-width: 100%;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.page-support-chat .page-back-nav {
    flex-shrink: 0;
    margin-bottom: 0.5rem !important;
}
.support-chat-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: none;
    margin: 0;
}
.support-chat-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0 !important;
    border: 1px solid #e2e8f0;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.support-chat-card__header {
    flex-shrink: 0;
}
.support-chat-card .chat-messages {
    flex: 1;
    height: auto !important;
    min-height: 12rem;
    max-height: none;
    overflow-y: auto;
}
.support-chat-card__footer {
    flex-shrink: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.support-chat-input {
    min-height: 44px;
    max-height: 120px;
}
.support-chat-send {
    flex-shrink: 0;
}
@media (min-width: 992px) {
    .page-support-chat.site-body {
        min-height: 100vh;
    }
    .page-support-chat .site-main {
        display: flex;
        flex-direction: column;
        min-height: 0;
        flex: 1;
    }
    .support-chat-page {
        min-height: calc(100dvh - 11rem);
    }
}
@media (max-width: 991.98px) {
    .support-chat-page {
        min-height: calc(100dvh - 10rem);
    }
}
.user-public-header .user-public-role {
    display: inline-block;
    font-size: 0.85rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}
.min-width-0 {
    min-width: 0;
}

#projects-page.projects-editing .project-open-btn.disabled {
    pointer-events: none;
    opacity: 0.65;
}
#projects-page.projects-editing .project-list-card {
    border-color: #cbd5e1;
}

/* Minimalist refresh (public site only, admin untouched) */
:root {
    --primary: #111827;
    --primary-dark: #030712;
    --primary-light: #eef2ff;
    --secondary: #0f766e;
    --secondary-dark: #115e59;
    --accent: #16a34a;
    --dark: #0b1220;
    --dark-soft: #1f2937;
    --light: #f8fafc;
    --surface: #ffffff;
    --gray: #475569;
    --border-radius: 14px;
    --border-radius-lg: 20px;
    --btn-radius: 10px;
    --box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
    --box-shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.site-body {
    background: var(--light);
    color: var(--dark);
}

.site-body::before {
    background-image: none;
}

.site-body::after {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.site-navbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.site-brand--navbar {
    --brand-icon-color: #0f172a;
}

.site-brand--navbar .site-brand__icon svg,
.site-brand--navbar .site-brand__icon svg rect {
    fill: #0f172a;
    color: #0f172a;
}

.site-brand--navbar .site-brand__name {
    color: #0f172a !important;
}

.nav-link {
    color: #334155 !important;
    font-weight: 500;
    border-radius: 8px;
}

.nav-link:hover {
    color: #0f172a !important;
    text-decoration: none;
    background: #f1f5f9;
}

.nav-link-cta {
    background: #111827 !important;
    color: #fff !important;
    border-radius: 10px !important;
    padding: 0.45rem 0.9rem !important;
}

.nav-link-cta:hover {
    background: #030712 !important;
}

.nav-notify-bell {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.nav-notify-bell:hover,
.nav-notify-bell[aria-expanded="true"] {
    background: #eef2f7;
    color: #0f172a;
}

.nav-user-block__name,
.nav-user-block__logout {
    color: #334155 !important;
}

.card {
    border: 1px solid #e5e7eb;
    box-shadow: var(--box-shadow);
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 1px solid #e5e7eb;
}

.btn:not(.btn-close):not(.btn-link),
.btn-sm:not(.btn-close):not(.btn-link),
.btn-lg:not(.btn-close):not(.btn-link) {
    border-radius: var(--btn-radius) !important;
    font-weight: 600;
    box-shadow: none !important;
    transform: none !important;
}

.btn {
    min-height: 42px;
    padding: 0.5rem 1rem;
}

.btn-sm {
    min-height: 36px;
    padding: 0.35rem 0.8rem;
}

.btn-primary {
    background: #111827;
    border-color: #111827;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #030712;
    border-color: #030712;
}

.btn-warning,
.btn-success {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff !important;
}

.btn-warning:hover,
.btn-success:hover {
    background: #115e59;
    border-color: #115e59;
}

.btn-outline-primary {
    color: #111827 !important;
    border-color: #cbd5e1;
    background: #fff;
}

.btn-outline-primary:hover {
    background: #f8fafc;
    color: #0f172a !important;
    border-color: #94a3b8;
}

.btn-outline-secondary {
    color: #334155 !important;
    border-color: #cbd5e1;
    background: #fff;
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    color: #0f172a !important;
    border-color: #94a3b8;
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: #d1d5db;
    background: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2);
}

/* Онбординг-тур (заказчик после регистрации) */
body.onboarding-tour-active {
    overflow: hidden;
}

.onboarding-tour {
    position: fixed;
    inset: 0;
    z-index: 1080;
    pointer-events: none;
}

.onboarding-tour__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.55);
    pointer-events: auto;
    cursor: pointer;
}

.onboarding-tour__spotlight {
    position: fixed;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
    pointer-events: none;
    z-index: 1;
    display: none;
}

.onboarding-tour-target {
    position: relative;
    z-index: 1081 !important;
}

.onboarding-tour-card {
    position: fixed;
    z-index: 1082;
    pointer-events: auto;
    max-width: min(360px, calc(100vw - 24px));
    padding: 1rem 1.1rem;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
    border: 1px solid #e2e8f0;
}

.onboarding-tour-card--center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.site-list-pagination .page-link {
    min-width: 2.25rem;
    text-align: center;
}

/* Sprint 2: пустые состояния, регистрация, мастер проекта, типы тендеров */
.flow-empty-state {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}
.flow-empty-state__icon {
    color: var(--primary);
    opacity: 0.85;
}
.role-pick__label {
    display: block;
    font-weight: 600;
}
.role-pick__desc {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray);
    margin-top: 0.2rem;
    line-height: 1.25;
}
.role-pick-grid--single .role-pick__box {
    min-height: 7.5rem;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 0.85rem 1rem;
}
.project-inline-pick--materials.is-selected {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
}
.project-inline-pick--works.is-selected {
    background: #ecfdf5;
    color: #047857;
    border-color: #6ee7b7;
}
.tender-type-card {
    display: block;
    padding: 1.25rem 1.35rem;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    color: inherit;
}
.tender-type-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}
.tender-type-card--materials:hover,
.tender-type-card--materials:focus-visible {
    border-color: #2563eb;
}
.tender-type-card--works:hover,
.tender-type-card--works:focus-visible {
    border-color: #10b981;
}
.tender-type-card__badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}
.tender-type-card--materials .tender-type-card__badge {
    background: #dbeafe;
    color: #1e40af;
}
.tender-type-card--works .tender-type-card__badge {
    background: #d1fae5;
    color: #065f46;
}

/* Sprint 3: mobile UX, a11y, bottom nav, foreman */
.text-muted,
.small.text-muted {
    color: var(--text-muted-accessible) !important;
}

.site-body--bottom-nav {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

.site-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
}

.site-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 48px;
    padding: 0.25rem 0.15rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted-accessible);
    text-decoration: none;
    border-radius: 10px;
}

.site-bottom-nav__item--active {
    color: var(--primary);
    background: var(--primary-light);
}

.site-bottom-nav__icon {
    line-height: 1;
}

.site-bottom-nav__item:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
    border-radius: 8px;
}

.calendar-mobile-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.portfolio-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: border-color 0.15s ease, background 0.15s ease;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portfolio-dropzone:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

.portfolio-dropzone--dragover,
.portfolio-dropzone:hover {
    border-color: var(--primary, #2563eb);
    background: #eff6ff;
}

.portfolio-dropzone__preview {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
}

.portfolio-dropzone--has-file {
    padding: 0.75rem;
}

.mobile-data-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.mobile-data-card--tender {
    cursor: pointer;
}

.mobile-data-card {
    display: block;
    padding: 0.9rem 1rem;
    background: var(--surface);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mobile-data-card:active,
.mobile-data-card:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.mobile-data-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.mobile-data-card__title {
    line-height: 1.3;
}

.mobile-data-card__foot {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--text-muted-accessible);
}

.landing-trust-stat {
    padding: 1rem 0.5rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--box-shadow);
    height: 100%;
}

.landing-trust-stat__value {
    display: block;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.landing-trust-stat__label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted-accessible);
    margin-top: 0.35rem;
    line-height: 1.25;
}

.site-skip-link {
    position: absolute;
    left: -9999px;
    top: 0.5rem;
    z-index: 1100;
    padding: 0.5rem 1rem;
    background: #fff;
    color: var(--primary);
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    font-weight: 600;
}

.site-skip-link:focus {
    left: max(0.5rem, var(--safe-left));
    top: max(0.5rem, var(--safe-top));
}

.landing-reviews-carousel {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    max-width: 720px;
    margin: 0 auto;
}

.landing-reviews-carousel__viewport {
    flex: 1;
    min-width: 0;
    position: relative;
    min-height: 140px;
}

.landing-review-card {
    display: none;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: var(--box-shadow);
}

.landing-review-card--active {
    display: block;
}

.landing-review-card__text {
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
}

.landing-reviews-carousel__nav {
    flex-shrink: 0;
    align-self: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.landing-reviews-carousel__nav:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.landing-reviews-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: #cbd5e1;
}

.landing-reviews-dot--active {
    background: var(--primary);
}

.landing-partner-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: var(--surface);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    height: 100%;
    text-align: center;
}

.stage-price-mobile .list-group-item {
    font-size: 0.9rem;
}

.landing-partner-pill__logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    opacity: 0.92;
}

.landing-partner-pill__name {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    color: #0f172a;
}

.directory-search-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    margin-top: 2px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 280px;
    overflow-y: auto;
}

.directory-suggest-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.directory-suggest-item:hover,
.directory-suggest-item:focus {
    background: #f8fafc;
}

.directory-suggest-item__label {
    font-weight: 600;
    color: #0f172a;
}

.project-stages-card .form-label {
    font-size: 0.875rem;
}

.mobile-data-card--stage-sub {
    margin-left: 0.75rem;
    border-left: 3px solid #e2e8f0;
}

.mobile-stage-actions .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 0.5rem);
    justify-content: center;
}

.project-stages-editing .mobile-data-card--stage.table-active,
.project-stages-editing .stage-row.table-active {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.mobile-data-card--bid-winner {
    border-color: #86efac;
    background: #f0fdf4;
}

.mobile-data-card--price .form-control {
    flex: 1 1 auto;
}

.tender-type-pick .tender-type-card {
    min-height: 44px;
}

@media (max-width: 767.98px) {
    .modal-dialog {
        margin-top: max(0.75rem, var(--safe-top));
    }

    .modal-dialog-centered {
        min-height: calc(100% - var(--safe-top) - var(--safe-bottom));
    }

    .foreman-widget-root:not(.foreman-widget-root--page).foreman-widget-root--mobile-collapsed .foreman-panel:not(.foreman-panel-open) {
        visibility: hidden;
        pointer-events: none;
        opacity: 0;
        transform: translateY(12px);
    }

    .foreman-widget-root:not(.foreman-widget-root--page) .foreman-fab {
        bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    }

    .site-body--bottom-nav .foreman-widget-root:not(.foreman-widget-root--page) .foreman-fab {
        bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    }

    .foreman-widget-root:not(.foreman-widget-root--page) .foreman-panel {
        bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
        max-height: min(60vh, 420px);
    }
}

/* Sprint 9 UX: wizard категорий мастера */
.contractor-categories-wizard__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 0.65rem;
}
.contractor-cat-wizard {
    margin: 0;
    cursor: pointer;
}
.contractor-cat-wizard__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    min-height: 5.5rem;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.contractor-cat-wizard__icon {
    color: var(--primary);
}
.contractor-cat-wizard__label {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}
.contractor-cat-wizard:has(.contractor-cat-input:checked) .contractor-cat-wizard__box {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}
.contractor-cat-wizard:focus-within .contractor-cat-wizard__box {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Лендинг: свёрнутый тизер Михалыча */
.landing-mikhalych-fold {
    background: #f8fafc;
    border-radius: 12px;
}
.landing-mikhalych-fold__summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    font-weight: 600;
}
.landing-mikhalych-fold__summary::-webkit-details-marker {
    display: none;
}
.landing-mikhalych-fold__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
}
.landing-mikhalych-fold[open] .landing-mikhalych-fold__hint::after {
    content: " · свернуть";
}
.portfolio-crop-canvas {
    max-height: 60vh;
    object-fit: contain;
    background: #0f172a;
}

.register-role-hint {
    border-left: 3px solid var(--primary);
}

/* ========== Тёмная тема (переключатель в подвале, data-theme="dark") ========== */
[data-theme="dark"] {
    --dark: #f1f5f9;
    --dark-soft: #cbd5e1;
    --light: #0f172a;
    --surface: #1e293b;
    --surface-raised: #273449;
    --gray: #94a3b8;
    --text-muted-accessible: #94a3b8;
    --primary-light: #1e3a8a;
    --primary-dark: #93c5fd;
    --border-subtle: 1px solid #334155;
    --box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --bs-body-bg: #0f172a;
    --bs-body-color: #f1f5f9;
    --bs-secondary-color: #94a3b8;
    --bs-tertiary-color: #64748b;
    --bs-border-color: #334155;
    --bs-card-bg: #1e293b;
    --bs-card-color: #f1f5f9;
    --bs-emphasis-color: #f8fafc;
    --bs-link-color: #93c5fd;
    --bs-link-hover-color: #bfdbfe;
    color-scheme: dark;
}

[data-theme="dark"] body.site-body {
    background: var(--light);
    color: var(--dark);
}

[data-theme="dark"] .site-body::after {
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.92) 0%,
        rgba(15, 23, 42, 0.96) 50%,
        rgba(15, 23, 42, 0.92) 100%
    );
}

[data-theme="dark"] .content-panel,
[data-theme="dark"] .card,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .table,
[data-theme="dark"] .alert:not(.alert-danger):not(.alert-success):not(.alert-warning) {
    background-color: var(--surface) !important;
    color: var(--dark);
    border-color: #334155;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
    background-color: var(--surface-raised) !important;
    border-color: #334155;
    color: var(--dark);
}

[data-theme="dark"] .table-scroll .site-data-table {
    background: var(--surface) !important;
}

[data-theme="dark"] .table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--dark);
    --bs-table-striped-bg: #273449;
    --bs-table-hover-bg: #334155;
    --bs-table-border-color: #334155;
}

[data-theme="dark"] .table thead th {
    color: var(--gray);
    border-bottom-color: #334155;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .small.text-muted {
    color: var(--text-muted-accessible) !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] a.text-dark,
[data-theme="dark"] .chat-list-link.text-dark,
[data-theme="dark"] .mobile-data-card.text-dark {
    color: var(--dark) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--surface-raised) !important;
    color: var(--dark) !important;
}

[data-theme="dark"] .badge.bg-light.text-dark {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .auth-otp__cell {
    background-color: var(--surface-raised);
    color: var(--dark);
    border-color: #475569;
}

[data-theme="dark"] .form-control::placeholder {
    color: #64748b;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .auth-otp__cell:focus {
    background-color: var(--surface-raised);
    color: var(--dark);
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] .btn-outline-secondary {
    border-color: #475569;
    color: #e2e8f0;
    background: transparent;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background: #334155;
    border-color: #64748b;
    color: #f8fafc;
}

[data-theme="dark"] .btn-link {
    color: #93c5fd;
}

[data-theme="dark"] .site-navbar {
    background: var(--surface) !important;
    border-bottom-color: #334155 !important;
}

[data-theme="dark"] .site-brand--navbar {
    --brand-icon-color: #f1f5f9;
}

[data-theme="dark"] .site-brand--navbar .site-brand__icon svg,
[data-theme="dark"] .site-brand--navbar .site-brand__icon svg rect {
    fill: #f1f5f9;
    color: #f1f5f9;
}

[data-theme="dark"] .site-brand--navbar .site-brand__name {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .nav-link {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .nav-link:hover {
    color: #f8fafc !important;
    background: #334155;
}

[data-theme="dark"] .nav-notify-bell {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
}

[data-theme="dark"] .nav-notify-bell:hover,
[data-theme="dark"] .nav-notify-bell[aria-expanded="true"] {
    background: #475569;
    color: #f8fafc;
}

[data-theme="dark"] .nav-user-block__name,
[data-theme="dark"] .nav-user-block__logout {
    color: #cbd5e1 !important;
}

@media (max-width: 991.98px) {
    [data-theme="dark"] .site-navbar .navbar-collapse {
        background: var(--surface);
        border-top-color: #334155;
    }
}

[data-theme="dark"] .site-footer {
    background: #020617;
    color: rgba(248, 250, 252, 0.78);
}

[data-theme="dark"] .site-footer strong {
    color: #f8fafc;
}

[data-theme="dark"] .footer-link {
    color: rgba(248, 250, 252, 0.72);
}

[data-theme="dark"] .footer-link:hover {
    color: #fff;
}

[data-theme="dark"] .site-bottom-nav {
    background: rgba(15, 23, 42, 0.97);
    border-top-color: #334155;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .site-bottom-nav__item {
    color: var(--text-muted-accessible);
}

[data-theme="dark"] .site-bottom-nav__item--active {
    color: #93c5fd;
    background: rgba(30, 58, 138, 0.45);
}

[data-theme="dark"] .role-pick__box {
    background: var(--surface);
    border-color: #475569;
    color: var(--dark);
}

[data-theme="dark"] .role-pick__desc {
    color: var(--gray);
}

[data-theme="dark"] .role-pick--active .role-pick__box,
[data-theme="dark"] .role-pick input:checked + .role-pick__box {
    background: rgba(30, 58, 138, 0.35);
    border-color: #60a5fa;
    color: #e2e8f0;
}

[data-theme="dark"] .register-role-hint,
[data-theme="dark"] .flow-empty-state,
[data-theme="dark"] .landing-mikhalych-fold,
[data-theme="dark"] .auth-visual--brand {
    background: var(--surface) !important;
    color: var(--dark);
}

[data-theme="dark"] .auth-email-mask {
    color: #e2e8f0;
}

[data-theme="dark"] .auth-mobile-hero__text {
    color: var(--gray);
}

[data-theme="dark"] .mobile-data-card {
    background: var(--surface);
    border-color: #334155;
}

[data-theme="dark"] .mobile-data-card__foot {
    color: var(--text-muted-accessible);
}

[data-theme="dark"] .project-list-row:hover,
[data-theme="dark"] .tenders-hub-row:hover,
[data-theme="dark"] .site-clickable-row:hover,
[data-theme="dark"] .chat-list-item:hover {
    background-color: #273449;
}

[data-theme="dark"] .chat-list-preview,
[data-theme="dark"] .chat-sender-role {
    color: var(--gray);
}

[data-theme="dark"] .chat-list-preview__who {
    color: #cbd5e1;
}

[data-theme="dark"] .chats-editing .chat-list-item--selected {
    background: rgba(30, 58, 138, 0.35);
}

[data-theme="dark"] .tender-card-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f8fafc;
}

[data-theme="dark"] .tender-card-header .badge.bg-light {
    background: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .tender-bids-table thead th {
    background: var(--surface-raised);
    border-bottom-color: #334155;
}

[data-theme="dark"] .tender-row-best {
    background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .calc-result-box,
[data-theme="dark"] .portfolio-dropzone {
    background: var(--surface-raised);
    border-color: #475569;
    color: var(--dark);
}

[data-theme="dark"] .portfolio-dropzone:hover,
[data-theme="dark"] .portfolio-dropzone--dragover {
    background: rgba(30, 58, 138, 0.25);
    border-color: #60a5fa;
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--surface);
    border-color: #334155;
    color: var(--dark);
}

[data-theme="dark"] .dropdown-item {
    color: var(--dark);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: #334155;
    color: #f8fafc;
}

[data-theme="dark"] .modal-content {
    background-color: var(--surface);
    color: var(--dark);
    border-color: #334155;
}

[data-theme="dark"] .list-group-item {
    border-color: #334155;
}

[data-theme="dark"] .border,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border.rounded,
[data-theme="dark"] .border.rounded-3 {
    border-color: #334155 !important;
}

[data-theme="dark"] .alert-secondary {
    background: var(--surface-raised);
    color: var(--dark);
    border-color: #334155;
}

[data-theme="dark"] .flow-screen-head h2,
[data-theme="dark"] .flow-screen-head h3,
[data-theme="dark"] .mobile-data-card__title,
[data-theme="dark"] .chat-list-title {
    color: var(--dark);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--dark);
}

[data-theme="dark"] .site-data-table-filters .form-control,
[data-theme="dark"] .site-data-table-filters .form-select {
    background-color: var(--surface-raised);
    color: var(--dark);
}

[data-theme="dark"] .scope-card--apt {
    border-color: #1e40af;
    background: linear-gradient(180deg, #1e3a5f 0%, var(--surface) 45%);
}

[data-theme="dark"] .scope-card--house {
    border-color: #c2410c;
    background: linear-gradient(180deg, #431407 0%, var(--surface) 45%);
}

[data-theme="dark"] .scope-list li {
    color: var(--dark-soft);
}

[data-theme="dark"] .ai-foreman-banner,
[data-theme="dark"] .ai-foreman-banner--teaser {
    background: linear-gradient(135deg, #1e293b 0%, #273449 55%, #1e3a5f 100%);
    border-color: #334155;
}

[data-theme="dark"] .ai-foreman-banner__badge {
    background: #422006;
    color: #fde68a;
}

[data-theme="dark"] .ai-pill {
    background: var(--surface-raised);
    border-color: #475569;
    color: #cbd5e1;
}

[data-theme="dark"] .feature-card--highlight {
    border-color: #ca8a04;
    background: linear-gradient(180deg, #422006 0%, var(--surface) 50%);
}

[data-theme="dark"] .hero-foreman-chip {
    background: var(--surface);
    border-color: #475569;
    color: var(--dark);
}

[data-theme="dark"] .hero-badge {
    background: var(--surface-raised);
    color: #e2e8f0;
}

[data-theme="dark"] .landing-review-card {
    background: var(--surface);
    border-color: #334155;
}

[data-theme="dark"] .landing-review-card__text {
    color: var(--dark);
}

[data-theme="dark"] .landing-trust-stat {
    background: var(--surface);
}

[data-theme="dark"] .site-skip-link:focus {
    background: var(--surface);
    color: #93c5fd;
}

[data-theme="dark"] .assistant-msg-assistant .assistant-bubble {
    background: var(--surface-raised);
    color: var(--dark);
    border-color: #475569;
}

[data-theme="dark"] .foreman-msg-assistant .foreman-bubble {
    background: var(--surface-raised);
    color: var(--dark);
    border-color: #475569;
}

[data-theme="dark"] .foreman-panel {
    background: var(--surface);
    border-color: #334155;
    color: var(--dark);
}

[data-theme="dark"] .foreman-panel-alert {
    background: #422006;
    color: #fde68a;
}

[data-theme="dark"] .chat-reply-quote,
[data-theme="dark"] .chat-reply-quote--link {
    color: var(--gray);
}

[data-theme="dark"] .input-group-text {
    background: var(--surface-raised);
    border-color: #475569;
    color: var(--dark);
}

[data-theme="dark"] .table-skeleton__row {
    background: linear-gradient(90deg, #273449 0%, #334155 50%, #273449 100%);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
    }
}

@media (prefers-reduced-motion: reduce) {
    .table-skeleton__row {
        animation: none;
    }
}