:root {
    --color-bg: #f3f4f6;
    --color-text: #111827;
    --color-text-muted: #6b7280;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-warning: #d97706;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(15,23,42,0.08);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body {
    margin: 0;
    min-width: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    line-height: 1.5;
}

/* Общий чат OpenBL — полоса под шапкой на всех страницах */
.global-openbl-chat-bar {
    margin: 0 0 1rem 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.global-openbl-chat-summary {
    list-style: none;
    cursor: pointer;
    padding: 0.55rem 1rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f1f5f9;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    user-select: none;
}
.global-openbl-chat-summary::-webkit-details-marker { display: none; }
.global-openbl-chat-summary-hint { font-weight: 400; font-size: 0.8rem; opacity: 0.85; color: #94a3b8 !important; }
.global-openbl-chat-inner {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--color-border);
    background: #f8fafc;
}
.global-openbl-chat-feed {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.65rem;
    padding: 0.35rem;
    background: #f1f5f9;
    border-radius: var(--radius);
}
.global-openbl-chat-form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: 48rem;
}
.global-openbl-chat-form input[type="text"],
.global-openbl-chat-form textarea {
    width: 100%;
    max-width: 36rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font: inherit;
    box-sizing: border-box;
}
.global-openbl-chat-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}
.global-openbl-chat-login-hint {
    margin: 0 0 0.85rem 0;
    padding: 0.45rem 0.85rem;
    background: #f1f5f9;
    border-radius: var(--radius);
    font-size: 0.9rem;
    border: 1px dashed var(--color-border);
}
.global-openbl-chat-login-hint a { font-weight: 600; }

.top-bar {
    background: #111827;
    color: #f9fafb;
    padding: 0.4rem 0.75rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    min-width: 0;
}

.top-bar-inner {
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
}

.top-nav a {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    padding: 0.3rem 0.5rem;
    flex-shrink: 0;
    border-radius: 0.35rem;
    transition: background-color 0.15s, color 0.15s;
}

.top-nav a:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
}

.top-nav a:focus-visible {
    outline: 2px solid rgba(255,255,255,0.6);
    outline-offset: 2px;
}

.top-nav a.top-nav-active {
    box-shadow: 0 0 0 2px #ffffff;
    color: #ffffff;
}

.top-nav-link-black-mail {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.top-nav-black-mail-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    box-shadow: 0 6px 14px rgba(239, 68, 68, 0.28);
    flex-shrink: 0;
}

.top-nav-black-mail-icon {
    font-size: 0.82rem;
    line-height: 1;
    filter: saturate(0%) brightness(1000%);
}

.top-nav-black-mail-count {
    position: absolute;
    top: -0.36rem;
    right: -0.48rem;
    min-width: 1.15rem;
    padding: 0.08rem 0.34rem;
    border-radius: 999px;
    background: #fff;
    color: #b91c1c;
    border: 2px solid #ef4444;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

/* Кнопка гамбургер-меню (скрыта на десктопе) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #fff;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sortable:hover {
    background: rgba(0,0,0,0.05);
}
.sort-icon {
    font-size: 0.85em;
    opacity: 0.9;
    margin-left: 0.15em;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 1rem;
}
.nav-dropdown-trigger {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
}
.nav-dropdown-trigger:hover {
    color: #ffffff;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    min-width: 180px;
    background: #1f2937;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    padding: 0.5rem 0;
    z-index: 50;
}
.analytics-block-card {
    display: block;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.analytics-block-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}
.analytics-block-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}
.analytics-block-card h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}
.analytics-block-card p {
    margin: 0;
    font-size: 0.9rem;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}
.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #e5e7eb;
    text-decoration: none;
    margin-left: 0;
    font-size: 0.9rem;
}
.nav-dropdown-menu a:hover {
    background: #374151;
    color: #ffffff;
}

.page-container {
    width: 100%;
    max-width: 1400px;
    min-width: 0;
    margin: 1.5rem auto;
    padding: 0 1rem 2rem;
    box-sizing: border-box;
    overflow-x: auto;
}

.index-frame {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0;
    padding: 1rem;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

/* Ширина по содержимому данных, заголовки с переносом */
.index-frame .table,
.employees-list-card .table {
    table-layout: fixed;
}
.index-frame .table th,
.employees-list-card .table th {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
}
.index-frame .table th,
.index-frame .table td,
.employees-list-card .table th,
.employees-list-card .table td {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    box-sizing: border-box;
}


.card {
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(15,23,42,0.08);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    overflow-y: visible;
    min-width: 0;
}

.card.narrow {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Узкие формы (вход): без горизонтального scroll-container — на iOS это иногда мешает фокусу и клавиатуре */
.card.card--auth-form {
    overflow-x: visible;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header h1, .card-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.card-body {
    padding: 1rem 1.25rem 1.25rem;
    min-width: 0;
}

.card-footer {
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid #e5e7eb;
}

.actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    padding: 0.55rem 1.25rem;
    font-size: 1rem;
    min-height: 2.5rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.05s ease, box-shadow 0.1s ease, background-color 0.1s ease;
}

.btn-sm {
    padding: 0.4rem 0.95rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37,99,235,0.35);
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(22,163,74,0.35);
}

.btn-success:hover {
    background: #15803d;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-outline-dark {
    background: #ffffff;
    color: #111111;
    border: 1px solid #111111;
    box-shadow: none;
}

.btn-outline-dark:hover {
    background: #f3f4f6;
    color: #111111;
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-link {
    background: transparent;
    color: #2563eb;
    padding: 0;
    min-height: auto;
    box-shadow: none;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-icon {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    min-height: auto;
    padding: 0.35rem;
    cursor: pointer;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.top-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.top-actions-bar {
    flex-shrink: 0;
}

.flash-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.flash {
    padding: 0.6rem 0.9rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.flash:last-child {
    margin-bottom: 0;
}

.flash-success {
    background: #ecfdf3;
    color: #166534;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
}

.flash-info {
    background: #eff6ff;
    color: #1d4ed8;
}

.flash-warning {
    background: #fefce8;
    color: #854d0e;
}

.table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.55rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.table th {
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.table th:not(:last-child),
.table td:not(:last-child) {
    border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.table thead {
    background: #f9fafb;
}

.table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.table tbody tr:hover {
    background: #eef2ff;
}

.text-right {
    text-align: right;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 200;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: #ffffff;
    border-radius: 0.75rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(15,23,42,0.4);
}

.modal-header,
.modal-footer {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    border-bottom: 0;
}

.modal-body {
    padding: 0.75rem 1rem 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.field span {
    color: #4b5563;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    outline: none;
    width: 100%;
    touch-action: manipulation;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37,99,235,0.2);
}

textarea {
    resize: vertical;
}

.form-vertical .form-actions,
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.form-actions.vertical {
    flex-direction: column;
    align-items: stretch;
}

.courier-skip-deposit-form {
    margin-bottom: 1rem;
}

.courier-summary .summary-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.courier-summary .summary-checkbox input {
    width: 1.1rem;
    height: 1.1rem;
}

.courier-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.summary-item {
    flex: 1 1 160px;
    padding: 0.6rem 0.8rem;
    background: #f9fafb;
    border-radius: 0.6rem;
}

.summary-label {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
}

.summary-value {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 0.15rem;
}

.tabs-header {
    align-items: center;
}

.tabs {
    display: flex;
    gap: 0.25rem;
}

.tab-btn {
    border-radius: 999px;
    border: none;
    padding: 0.35rem 0.9rem;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4b5563;
}

.tab-btn.active {
    background: #e5e7eb;
    color: #111827;
}

.tabs-actions {
    display: flex;
    gap: 0.5rem;
}

.tab-content {
    display: none;
    margin-top: 0.75rem;
}

.tab-content.active {
    display: block;
}

.report-items-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.report-items-table th,
.report-items-table td {
    text-align: center;
    vertical-align: middle;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.report-items-table .text-right {
    text-align: right;
}

.report-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.report-left {
    flex: 3;
    min-width: 0;
}

.report-right {
    flex: 2;
}

.report-step {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    border-left: 4px solid #2563eb;
}

.report-step h2,
.report-step h3 {
    font-size: 1rem;
    margin: 0 0 0.75rem;
    color: #1e293b;
}

.report-step .form-inline .field {
    margin-bottom: 0;
}

.block {
    margin-bottom: 1rem;
}

.block h2 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.form-inline.form-add-row {
    flex-wrap: nowrap;
    align-items: center;
}

.form-inline.form-add-row .field {
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.form-inline.form-add-row .field:first-of-type {
    flex: 1 1 140px;
}

.form-inline.form-add-row .field input[type="number"] {
    min-width: 4rem;
}

.form-inline.form-add-row .btn {
    flex-shrink: 0;
    align-self: center;
}

@media (max-width: 640px) {
    .form-inline.form-add-row {
        flex-wrap: wrap;
    }
}

.courier-current {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #374151;
}

.effectiveness-block {
    margin-bottom: 1rem;
}

.effectiveness-value {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.effectiveness-details {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: #4b5563;
}

.effectiveness-formula {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.effectiveness-formula-example {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.effectiveness-placeholder {
    color: #9ca3af;
    font-style: italic;
    margin: 0;
}

.effectiveness-period {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.effectiveness-details-block {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Итоги недели и сводки отчётов — полная насыщенность цвета */
.report-summary-list,
.report-summary-list .effectiveness-details,
.report-summary-list .effectiveness-formula,
.report-summary-list .effectiveness-formula-example,
.report-summary-list .effectiveness-period {
    color: #111827 !important;
    opacity: 1;
}
.report-summary-list .payout-total,
.report-detail-summary .payout-total {
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.effectiveness-motivation {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.effectiveness-motivation.motivation-premium {
    color: #059669;
}

.effectiveness-motivation.motivation-penalty {
    color: #dc2626;
}

.effectiveness-motivation.motivation-neutral {
    color: #6b7280;
}

.effectiveness-recommendation {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
    border-left: 4px solid #6b7280;
}

.effectiveness-recommendation .effectiveness-rec-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #374151;
}

.report-preview-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .report-preview-split {
        grid-template-columns: 1fr;
    }
}

.preview-box {
    border-radius: 0.75rem;
    background: #f9fafb;
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
    border: 1px dashed #d1d5db;
    opacity: 0.5;
}

.preview-box.visible {
    border-style: solid;
    border-color: #2563eb;
    background: #eff6ff;
    opacity: 1;
}

/* Предпросмотр склада — яркий блок «Было → Стало» */
.preview-box-warehouse.visible {
    border-color: #059669;
    border-width: 2px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

.preview-warehouse-was-became {
    background: #fff;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid #a7f3d0;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.1);
}

.preview-warehouse-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: #047857;
    font-weight: 700;
}

.preview-warehouse-was-became ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.preview-warehouse-was-became li {
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.preview-warehouse-was-became strong {
    color: #065f46;
}

.preview-warehouse-details {
    font-size: 0.9rem;
    color: #4b5563;
}

.preview-box ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.preview-box li {
    margin-bottom: 0.25rem;
}

.preview-badge {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.preview-badge-deposit {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.preview-box-overage {
    border-color: #dc2626 !important;
    border-width: 2px !important;
    background: #fef2f2 !important;
}

.preview-overage-warning {
    margin: 0 0 0.5rem;
    padding: 0.4rem 0.6rem;
    background: #dc2626;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 0.375rem;
    text-align: center;
}

.preview-no-payout {
    color: #6b7280;
    font-style: italic;
}

.preview-remaining-warning {
    color: #b45309;
    background: #fef3c7;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    list-style: none;
}
.preview-remaining-info {
    color: #1e40af;
    background: #dbeafe;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    list-style: none;
}

.preview-penalty-deposit-warning {
    color: #b45309;
    background: #fef3c7;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    list-style: none;
    line-height: 1.5;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-deposit {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.badge-normal {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-newcomer {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
    text-decoration: none;
}
.badge-success:hover {
    background: #a7f3d0;
    color: #065f46;
}

/* Роли в админке OpenBL и др. */
.badge-role-courier {
    background: #0ea5e9;
    color: #fff;
}
.badge-role-warehouse {
    background: #059669;
    color: #fff;
}
.badge-role-both {
    background: #4f46e5;
    color: #fff;
}

/* Отчёты по фото, уже добавленные в выкладку */
.photo-report-in-placement {
    background: #ecfdf5 !important;
}
.photo-report-in-placement:hover {
    background: #d1fae5 !important;
}

.report-row-deposit {
    background: #fffbeb !important;
}

.report-row-deposit:hover {
    background: #fef3c7 !important;
}

/* Выбор типа отчёта: по выкладке / еженедельный */
.report-type-choice {
    padding: 1.5rem !important;
}
.report-type-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.report-type-card {
    display: block;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.report-type-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}
.report-type-daily {
    border-left: 4px solid #16a34a;
}
.report-type-weekly {
    border-left: 4px solid #7c3aed;
}
.report-type-warehouse {
    border-left: 4px solid #9333ea;
}
.report-type-warehouse:hover {
    border-color: #9333ea;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}
.report-type-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}
.report-type-card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}
.report-type-card p {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Выделение типа отчёта в списке */
.report-row-daily {
    border-left: 4px solid #16a34a;
}
.report-row-weekly {
    border-left: 4px solid #7c3aed;
    background: #f5f3ff !important;
}
.report-row-weekly:hover {
    background: #ede9fe !important;
}

.badge-daily {
    background: #dcfce7;
    color: #166534;
}
.badge-weekly {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-warehouse-courier {
    background: #dbeafe;
    color: #1e40af;
}

.bylo-stalo {
    font-size: 0.9rem;
    color: #6b7280;
    margin-left: 0.25rem;
}
.report-footnote.bylo-stalo-footnote {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    font-size: 0.9rem;
    color: #475569;
}
.report-footnote.bylo-stalo-footnote p {
    margin: 0.25rem 0;
}
.report-footnote .footnote-explanation {
    margin-top: 0.5rem;
    font-style: italic;
}
.penalty-forgiven {
    color: #16a34a;
    font-weight: 500;
}
.penalty-withheld {
    color: #b45309;
    font-weight: 500;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn + .inline-form,
.actions-cell .inline-form {
    display: inline-block;
    margin-left: 0.5rem;
}

.inline-form {
    display: inline-block;
}

.form-edit-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.form-edit-date .input-date {
    padding: 0.25rem 0.5rem;
    font-size: 0.95rem;
}
.report-detail-row-date .report-detail-label {
    margin-right: 0.5rem;
}

.log-note {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.report-lock-hint {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #6b7280;
    font-style: italic;
}

.report-lockable select:disabled,
.report-lockable input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.issue-page-layout {
    max-width: none;
}

.issue-page-body {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.issue-left {
    flex: 0 1 400px;
    min-width: 0;
}

.issue-right {
    flex: 1 1 360px;
    min-width: 0;
}

.issue-right .issue-report-title {
    margin-top: 0;
}

.issued-empty {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
}

.issued-parcels-list .table-wrapper {
    max-height: 60vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .issue-page-body {
        flex-direction: column;
    }
}

.info-block {
    padding-top: 0;
    padding-bottom: 0.5rem;
}

.info-deposit {
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #92400e;
}

.issue-report {
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.issue-report-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.issue-report-row {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.issue-report-label {
    color: #4b5563;
}

.issue-report-value {
    margin-left: 0.25rem;
}

.issue-overage-notice {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #b91c1c;
    font-size: 0.9rem;
}

.report-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.report-link:hover {
    text-decoration: underline;
}

.report-detail-meta {
    margin-bottom: 1.5rem;
}

.report-detail-row {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.report-detail-row .badge {
    margin-left: 0.5rem;
}

.report-detail-section-title {
    margin: 1.25rem 0 0.75rem;
    font-size: 1rem;
    color: #4b5563;
}

.report-detail-section-title:first-of-type {
    margin-top: 0;
}

.report-detail-summary {
    margin-bottom: 0.5rem;
}

.report-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem 1.5rem;
}

.report-detail-item {
    font-size: 0.9rem;
}

.report-detail-label {
    color: #6b7280;
    display: block;
    margin-bottom: 0.15rem;
}

.report-detail-value {
    font-weight: 500;
}

.preview-error-msg {
    color: #b91c1c;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.motivation-block .motivation-label.motivation-premium,
.motivation-label.motivation-premium {
    color: #059669;
    font-weight: 600;
}

.motivation-block .motivation-label.motivation-penalty,
.motivation-label.motivation-penalty {
    color: #dc2626;
    font-weight: 600;
}

.motivation-block .motivation-label.motivation-neutral,
.motivation-label.motivation-neutral {
    color: #6b7280;
}

.payout-breakdown-title {
    margin-top: 0.5rem;
}

.payout-breakdown-minus {
    color: #dc2626;
}

.payout-breakdown-plus {
    color: #059669;
}

.report-detail-full {
    grid-column: 1 / -1;
}

.motivation-table input {
    padding: 0.25rem 0.5rem;
}

.motivation-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.motivation-checkbox input {
    width: auto;
}

.report-detail-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Аналитика */
.analytics-header {
    flex-wrap: wrap;
}

.analytics-period {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analytics-period .btn { margin-left: 0.25rem; }

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.analytics-block h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: #4b5563;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.95rem;
}

.metric-row.muted { color: #6b7280; font-size: 0.85rem; }

.task-countdown {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}
.task-countdown-green { background: #d1fae5; color: #065f46; }
.task-countdown-orange { background: #ffedd5; color: #9a3412; }
.task-countdown-red { background: #fee2e2; color: #991b1b; }

.warehouse-requests-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
}

.warehouse-requests-filters .field {
    margin: 0;
    min-width: 12rem;
}

.warehouse-requests-filters select {
    min-width: 12rem;
}

.warehouse-requests-filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.warehouse-requests-section + .warehouse-requests-section {
    margin-top: 1.5rem;
}

.warehouse-requests-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.warehouse-requests-section-secondary {
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.warehouse-request-badge-awaiting {
    background: #d97706;
    color: #fff;
    border: 1px solid #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

.warehouse-request-row-complete {
    background: #ecfdf5;
}

.warehouse-request-row-overdue {
    background: #fef2f2;
}

.metric-label { color: #6b7280; }
.metric-value { font-weight: 600; }

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.status-excellent {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.status-normal {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.status-fail {
    background: #fee2e2;
    color: #991b1b;
}

.progress-group {
    margin-bottom: 1rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.progress-value { font-weight: 600; }

.progress-bar-wrap {
    height: 1.25rem;
    background: #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 0.5rem;
    transition: width 0.5s ease;
}

.progress-small { background: #f59e0b; }
.progress-medium { background: #10b981; }
.progress-large { background: #3b82f6; }

.analytics-recommendations h2 {
    margin: 1.5rem 0 0.75rem;
    font-size: 1rem;
    color: #4b5563;
}

.rec-card {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.rec-card.rec-success { background: #d1fae5; color: #065f46; }
.rec-card.rec-info { background: #dbeafe; color: #1e40af; }
.rec-card.rec-warning { background: #fef3c7; color: #92400e; }
.rec-card.rec-danger { background: #fee2e2; color: #991b1b; }

/* Персональные рекомендации: как rec-card.rec-info — голубая подложка, тёмный текст */
.analytics-personalized {
    padding: 1rem 1.1rem;
    border-radius: 0.5rem;
    border: 1px solid #93c5fd;
    background: #dbeafe;
}
.analytics-personalized h2 {
    margin-bottom: 0.75rem;
    color: #4b5563;
}
.personalized-recommendations-panel {
    margin-top: 0;
    padding: 0;
    border: none;
    background: transparent;
}
.personalized-rec-line {
    margin: 0 0 0.65rem 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: #111827;
}
.personalized-rec-line:last-child {
    margin-bottom: 0;
}
.personalized-rec-closing {
    font-weight: 600;
    padding-top: 0.35rem;
    margin-top: 0.35rem;
    border-top: 1px solid #93c5fd;
    color: #111827;
}

.analytics-table .status-row-fail { background: #fef2f2; }
.analytics-table .status-row-normal { background: #fffbeb; }
.analytics-table .status-row-excellent { background: #f0fdf4; }

.analytics-col-hint {
    cursor: help;
    text-decoration: underline dotted;
    text-underline-offset: 0.12em;
}

table.table-sortable thead th.th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
table.table-sortable thead th.th-sortable:hover {
    background: rgba(15, 23, 42, 0.06);
}
table.table-sortable thead th.sort-asc::after,
table.table-sortable thead th.sort-desc::after {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.65em;
    opacity: 0.75;
    vertical-align: middle;
}
table.table-sortable thead th.sort-asc::after {
    content: "▲";
}
table.table-sortable thead th.sort-desc::after {
    content: "▼";
}

.courier-rating-legend {
    max-width: 52rem;
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem 1.05rem;
    background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.courier-rating-legend-title {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: 0.01em;
}
.courier-rating-legend p {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #475569;
}
.courier-rating-legend p:last-child {
    margin-bottom: 0;
}
.courier-rating-legend .metric-name {
    display: inline;
    font-weight: 600;
    color: #0f172a;
}

.reports-scrollable {
    max-height: 450px;
    overflow-y: auto;
}

.eff-col {
    background: #f5f3ff;
    font-weight: 600;
}

.metric-row.metric-highlight {
    background: #f5f3ff;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    margin: 0.25rem 0;
}

.metric-hint {
    font-size: 0.8rem;
    margin: 0.25rem 0 0.5rem 0;
}

.analytics-summary .summary-item {
    padding: 0.5rem 0.75rem;
    background: #d1d5db;
    border-radius: 0.5rem;
}
.analytics-summary .summary-label {
    display: block;
    font-size: 0.8rem;
    color: #4b5563;
    margin-bottom: 0.25rem;
}
.analytics-summary .summary-value {
    font-weight: 600;
    font-size: 1rem;
}
.summary-hint {
    margin-left: 0.25rem;
    cursor: help;
    opacity: 0.7;
}

.summary-curator-income {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
    max-width: 100%;
}

.summary-curator-income .summary-label {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.2rem;
}

.summary-curator-income .summary-value {
    font-weight: 700;
    font-size: 1.35rem;
}

.summary-curator-income .summary-formula {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    margin-left: auto;
}

@media (max-width: 768px) {
    .page-container {
        padding: 0 0.5rem 1.5rem;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .tabs-header {
        align-items: flex-start;
    }
    .tabs-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .report-layout {
        flex-direction: column;
    }
}

/* Список выставленных штрафов */
.penalty-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.penalty-list-item {
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.penalty-list-item details {
    display: block;
}

.penalty-list-summary {
    padding: 0.6rem 1rem;
    cursor: pointer;
    background: #f9fafb;
    font-size: 0.95rem;
    user-select: none;
}

.penalty-list-summary:hover {
    background: #f3f4f6;
}

.penalty-list-summary::-webkit-details-marker {
    display: inline-block;
    margin-right: 0.5rem;
}

.penalty-id {
    font-weight: 600;
    color: #374151;
    margin-right: 0.75rem;
}

.penalty-courier {
    color: #4b5563;
    margin-right: 0.75rem;
}

.penalty-total {
    font-weight: 600;
    color: #059669;
}

.penalty-breakdown {
    padding: 1rem;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.penalty-breakdown .table {
    margin: 0;
    font-size: 0.9rem;
}

.penalty-list-empty {
    padding: 1rem;
    color: #6b7280;
    font-size: 0.9rem;
    font-style: italic;
    border: 1px dashed #d1d5db;
    border-radius: 0.5rem;
    background: #f9fafb;
}

/* Погашенные штрафы */
.penalty-list-item-settled .penalty-list-summary {
    background: #f0fdf4;
    cursor: default;
}

.penalty-list-item-settled .penalty-list-summary:hover {
    background: #f0fdf4;
}

.penalty-badge-settled {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #059669;
    background: #d1fae5;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}

.penalty-settled-link {
    color: #059669;
    text-decoration: none;
}

.text-muted {
    color: #9ca3af;
    font-style: italic;
}

.penalty-log-details {
    font-size: 0.85rem;
    color: #6b7280;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.penalty-log-details:hover {
    white-space: normal;
    overflow: visible;
}

.penalty-settled-link:hover {
    text-decoration: underline;
}

/* ========== Мобильная адаптация ========== */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .top-bar-inner {
        flex-wrap: wrap;
    }

    .top-nav {
        display: none;
        width: 100%;
        order: 3;
        flex-direction: column;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255,255,255,0.2);
    }

    .top-nav.open {
        display: flex;
    }

    .top-nav a {
        margin-left: 0;
        margin-bottom: 0.5rem;
        padding: 0.5rem 0;
        font-size: 1rem;
    }

    .top-nav a.top-nav-active {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    .top-bar-inner {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0.5rem 0.75rem;
    }
}

/* iOS / Android: шрифт полей не меньше 16px — иначе зум при фокусе и сбои виртуальной клавиатуры */
@media (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="search"],
    input[type="url"],
    input[type="date"],
    input[type="datetime-local"],
    select,
    textarea {
        font-size: 16px;
    }
}

/* Таблица: горизонтальный скролл на мобильных */
.table-wrapper {
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

@media (max-width: 1024px) {
    .page-container {
        padding: 0 0.75rem 1.5rem;
    }
    .card-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .table-wrapper {
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .table {
        min-width: 500px;
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.4rem;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    .card-footer.actions {
        flex-direction: column;
    }

    .card-footer.actions .btn {
        width: 100%;
        justify-content: center;
    }

    .page-container {
        padding: 0 0.5rem 1.5rem;
    }

    .upload-reports-toolbar {
        flex-wrap: wrap;
    }

    .photos-bulk-actions form {
        flex-shrink: 0;
    }

    .btn-sm {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
    }
}

@media (max-width: 480px) {
    .table {
        min-width: 400px;
    }
    .photo-upload-dropzone {
        min-width: 100%;
    }
}

/* --- Проверка фото --- */
.photo-upload-form {
    margin: 1rem 0;
}
.photo-upload-layout {
    display: flex;
    gap: 1.25rem;
    align-items: stretch;
    flex-wrap: wrap;
}
.photo-upload-dropzone {
    flex: 0 0 calc(33.333% - 0.5rem);
    min-width: 200px;
    min-height: 120px;
    background: #e0f2fe;
    border: 2px dashed #7dd3fc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}
.photo-upload-dropzone:hover,
.photo-upload-dropzone.photo-dropzone-dragover {
    background: #bae6fd;
    border-color: #38bdf8;
}
.photo-upload-dropzone.photo-dropzone-ready {
    background: #dcfce7;
    border-color: #22c55e;
}
.photo-upload-dropzone.photo-dropzone-ready:hover {
    background: #bbf7d0;
    border-color: #16a34a;
}
.photo-dropzone-count {
    font-size: 1rem;
    font-weight: 600;
    color: #15803d;
}
.photo-upload-dropzone input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}
.photo-upload-dropzone {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
}
.photo-dropzone-text {
    font-size: 0.9rem;
    color: #0369a1;
    text-align: center;
}
.photo-dropzone-browse {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    background: #0ea5e9;
    color: #fff;
    border-radius: 0.5rem;
    cursor: pointer;
}
.photo-upload-fields {
    flex: 1;
    min-width: 280px;
}
.photo-upload-form .field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.photo-upload-form .field-row .field {
    flex: 1 1 200px;
    min-width: 180px;
}
.photo-upload-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.photo-select-error {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 1rem 0 0.5rem;
}
.upload-reports-section {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}
.upload-reports-section .table-wrapper {
    margin-left: 0;
    margin-right: 0;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    max-width: 100%;
}
.photo-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    position: relative;
}
.photo-card-id {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 5;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    line-height: 1.5rem;
    text-align: center;
}
.photo-card-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
}
.photo-card-checkbox input {
    cursor: pointer;
    width: 1.1rem;
    height: 1.1rem;
}
.photos-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}
.photos-bulk-actions > div {
    flex-wrap: wrap;
    min-width: 0;
}
.photos-select-all-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.85rem;
    min-height: 2rem;
    padding: 0.35rem 0;
}
.photo-card-labels {
    position: absolute;
    top: 0.5rem;
    left: 2.2rem;
    z-index: 3;
    display: flex;
    flex-direction: row;
    gap: 0.25rem;
    align-items: center;
}
.photo-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: #dc2626;
    border-radius: 2px;
    line-height: 1.2;
    width: 2.8rem;
    height: 2.8rem;
    text-align: center;
    box-sizing: border-box;
    white-space: normal;
    word-break: break-word;
}
.photo-label-duplicate {
    background: #dc2626;
    color: #fff;
}
.photo-label-distance {
    background: #facc15;
    color: #000;
}
.photo-label-gov-poi {
    background: #ea580c;
    color: #fff;
}
.photo-label-rejected {
    background: #dc2626;
    color: #fff;
}
.photo-modal-img-wrap {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    line-height: 0;
}
.photo-modal-img-wrap .photo-card-labels {
    top: 0.75rem;
    left: 0.75rem;
    gap: 0.5rem;
}
.photo-modal-img-wrap .photo-label {
    font-size: 1.15rem;
    padding: 0.6rem 0.8rem;
    min-width: 5rem;
    width: auto;
    height: auto;
    line-height: 1.2;
    border-radius: 8px;
}
.photo-thumb-wrap {
    cursor: pointer;
    display: block;
    position: relative;
    overflow: hidden;
    height: 200px;
    transition: opacity 0.2s;
}
.photo-thumb-wrap:hover {
    opacity: 0.9;
}
.photo-thumb {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: left bottom;
    transform: scale(2);
    transform-origin: left bottom;
    display: block;
    pointer-events: none;
}
.photo-coords {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.photo-edit-coords-btn {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.15rem 0.35rem;
}
.coord-source { color: #6b7280; font-size: 0.9em; }

/* Модальное окно просмотра фото */
.photo-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}
.photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}
.photo-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}
.photo-modal-content img {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}
.photo-modal-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}
.photo-modal-prev,
.photo-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    line-height: 1;
    border-radius: 4px;
}
.photo-modal-prev { left: -3rem; }
.photo-modal-next { right: -3rem; }
.photo-modal-prev:hover,
.photo-modal-next:hover {
    background: rgba(255,255,255,0.35);
}
.photo-modal-reject-btn {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.55rem 1.1rem;
    border: 2px solid #dc2626;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #dc2626;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,0.28);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.photo-modal-reject-btn:hover:not(:disabled) {
    background: rgba(254, 242, 242, 0.98);
    color: #b91c1c;
    border-color: #b91c1c;
}
.photo-modal-reject-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.photo-modal-reject-btn.photo-modal-reject-btn--active {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.photo-modal-reject-btn.photo-modal-reject-btn--active:hover:not(:disabled) {
    background: #b91c1c;
    color: #fff;
    border-color: #b91c1c;
}
.photo-modal-name {
    color: #fff;
    margin: 0.75rem 0 0.25rem;
    font-weight: 500;
}
.photo-modal-coords {
    color: #d1d5db;
    font-family: ui-monospace, monospace;
    font-size: 0.95rem;
    margin: 0;
}

/* Модальное окно редактирования координат */
.coords-edit-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 1rem;
}
.coords-edit-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    cursor: pointer;
}
.coords-edit-content {
    position: relative;
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    min-width: 320px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.coords-edit-content h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}
.coords-edit-filename {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #6b7280;
    word-break: break-all;
}
.coords-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.coords-edit-fields label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
}
.coords-edit-fields input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: ui-monospace, monospace;
}
.coords-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.coords-edit-actions .coords-edit-btn {
    min-width: 6.5rem;
}

.photo-info {
    padding: 1rem 0.75rem 0.5rem;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}
.photo-info strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.text-warning { color: #b45309; }
.muted { color: #6b7280; font-size: 0.9rem; margin: 0.25rem 0; }
.inactive-row { opacity: 0.6; background: #f9fafb; }
.settings-card {
    cursor: pointer;
}
.settings-card:hover { background: #f3f4f6; }
.duplicates-list {
    margin: 1rem 0;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
}
.registry-section {
    margin: 0 0 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
}
.registry-tab-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.registry-tab-btn {
    padding: 0.35rem 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
}
.registry-tab-btn:hover {
    background: #f9fafb;
}
.registry-tab-btn.active {
    background: #e5e7eb;
    border-color: #d1d5db;
}
.registry-tab-content {
    display: none;
}
.registry-tab-content.active {
    display: block;
}
.registry-actions-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.registry-form-inline {
    display: inline;
}
.registry-form-inline button { margin: 0; }
.btn-registry {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    font-weight: 500;
    min-height: 2rem;
    min-width: 8rem;
}
.btn-registry-selected {
    background: #fff;
    color: #dc2626;
    border: 2px solid #dc2626;
}
.btn-registry-selected:hover {
    background: #fef2f2;
}
.btn-registry-all {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.btn-registry-all:hover {
    background: #b91c1c;
}
.registry-table-wrap { margin-bottom: 1rem; }
.th-checkbox, .td-checkbox { width: 2rem; text-align: center; vertical-align: middle; }
.th-checkbox input, .td-checkbox input { cursor: pointer; }
.registry-section h2 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.duplicates-list ul { margin: 0.5rem 0 0 1.5rem; }
.matrix-table { font-size: 0.85rem; }
.matrix-table th, .matrix-table td { padding: 0.35rem 0.5rem; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.stat-card {
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.stat-label { font-size: 0.85rem; color: #6b7280; }
.stat-value { font-weight: 600; font-size: 1.1rem; }

/* Оверлей загрузки фото */
.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.upload-progress-box {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    min-width: 320px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.upload-status {
    margin: 0 0 1rem;
    font-weight: 500;
}
.progress-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: #22c55e;
    border-radius: 6px;
    transition: width 0.2s ease;
}
.upload-timer {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
}

/* Управление картой */
.map-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}
.map-controls label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Метки точек на карте с номером */
.map-point-marker { background: transparent !important; border: none !important; }
.map-gov-marker { background: transparent !important; border: none !important; }
.map-gov-marker div { box-sizing: border-box; }
.map-point-inner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Метки расстояний на карте (поверх слоя POI) */
.map-distance-label {
    background: rgba(255,255,255,0.95);
    border: 1px solid #111827;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.map-distance-label span {
    display: block;
}

/* Подпись на кругах POI из Яндекс Geosearch */
.leaflet-tooltip.map-poi-yandex-tt {
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(17, 24, 39, 0.45);
    color: #111827;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.leaflet-tooltip.map-poi-yandex-tt::before {
    display: none;
}

.map-poi-manual-actions {
    margin-top: 0.5rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.map-poi-manual-actions .map-poi-delete-btn {
    width: 100%;
}

/* Линейка на карте */
.map-ruler-point { background: transparent !important; border: none !important; }
.map-ruler-label {
    background: rgba(255,255,255,0.95);
    border: 1px solid #16a34a;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #15803d;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.map-ruler-label span { display: block; }
.map-ruler-result { margin-left: 0.5rem; font-weight: 600; color: #15803d; }

/* Правоохранительные органы — круг красно-синий */
.map-law-marker { background: transparent !important; border: none !important; }

/* Поиск при выборе города/района */
.searchable-select-wrap {
    position: relative;
}
.searchable-select-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: #fff;
}
.searchable-select-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.searchable-select-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: 2px;
}
.searchable-select-list.open {
    display: block;
}
.searchable-select-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
}
.searchable-select-item:hover {
    background: #f3f4f6;
}
.searchable-select-item:first-child {
    border-radius: 0.375rem 0.375rem 0 0;
}

.black-mail-shell {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 7rem);
    min-height: 70vh;
}

.black-mail-shell-header {
    align-items: flex-start;
    flex-shrink: 0;
}

.black-mail-shell-subtitle {
    margin: 0.35rem 0 0;
}

.black-mail-shell-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.black-mail-sound-toggle {
    min-width: 6.9rem;
    justify-content: center;
}

.black-mail-live-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-size: 0.85rem;
    font-weight: 600;
}

.black-mail-live-status.warn {
    background: #fef3c7;
    color: #92400e;
}

.black-mail-live-status.ok {
    background: #dcfce7;
    color: #166534;
}

.black-mail-top-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0 1.25rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.black-mail-kind-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.black-mail-kind-tab.has-unread {
    padding-right: 2.3rem;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.12);
}

.black-mail-kind-tab.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.black-mail-tab-mail {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    top: -0.38rem;
    right: -0.12rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 6px 14px rgba(239, 68, 68, 0.24);
}

.black-mail-tab-unread {
    position: absolute;
    top: -0.38rem;
    right: -0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    padding: 0.12rem 0.42rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.22);
}

.black-mail-kind-tab.active .black-mail-tab-mail {
    border-color: #111827;
}

.black-mail-kind-tab.active .black-mail-tab-unread {
    background: #ef4444;
    color: #fff;
    border-color: #111827;
}

.black-mail-thread-unread {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    padding: 0.1rem 0.38rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.1;
    background: #ef4444;
    color: #fff;
}

.black-mail-thread-item.active .black-mail-thread-unread {
    background: #fca5a5;
    color: #450a0a;
}

.black-mail-manager-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
    padding: 1rem 1.25rem 0;
}

.black-mail-manager-bar label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.black-mail-manager-bar select,
.black-mail-sidebar-toolbar input,
.black-mail-sidebar-toolbar select,
.black-mail-composer textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.9rem;
    padding: 0.75rem 0.9rem;
    font: inherit;
    background: #fff;
    color: #111827;
}

.black-mail-sidebar-toolbar select {
    accent-color: #111827;
}

.black-mail-sidebar-toolbar select:focus,
.black-mail-sidebar-toolbar input:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 1px #111827;
}

.black-mail-composer-field-wrap {
    position: relative;
    width: 100%;
}

.black-mail-mention-suggest {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    margin-bottom: 0.35rem;
    z-index: 20;
    max-height: 11rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 0.25rem 0;
}

.black-mail-mention-suggest button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    margin: 0 0.3rem 0.2rem;
    background: transparent;
    font: inherit;
    cursor: pointer;
    color: #0f172a;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.black-mail-mention-suggest button:hover,
.black-mail-mention-suggest button.active {
    background: #111827;
    border-color: #9ca3af;
    color: #fff;
}

.black-mail-mention-suggest .muted {
    font-size: 0.8rem;
    color: #64748b;
}

.black-mail-mention-suggest .black-mail-mention-hint {
    padding: 0.5rem 0.75rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.35;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    pointer-events: none;
}

.black-mail-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.black-mail-sidebar {
    border-right: 1px solid #e5e7eb;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    align-self: stretch;
}

.black-mail-sidebar-toolbar {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.black-mail-curator-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    padding: 0.5rem 0 0 0;
    border-top: 1px dashed #e2e8f0;
    margin-top: 0.15rem;
    font-size: 0.82rem;
}

.black-mail-curator-filters-label {
    font-weight: 600;
    color: #475569;
    width: 100%;
}

.black-mail-curator-filters select {
    max-width: 11rem;
}

.black-mail-curator-idle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.black-mail-curator-idle-label input {
    width: 3.2rem;
    padding: 0.2rem 0.35rem;
}

.black-mail-sidebar-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.4rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #9ca3af #e5e7eb;
}

.black-mail-sidebar-list::-webkit-scrollbar {
    width: 10px;
}

.black-mail-sidebar-list::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 999px;
}

.black-mail-sidebar-list::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 999px;
    border: 2px solid #e5e7eb;
}

.black-mail-sidebar-list::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.black-mail-sidebar-empty {
    padding: 1rem;
    color: #64748b;
}

.black-mail-thread-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 1rem;
    padding: 0.85rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.35rem;
    color: #111827;
    -webkit-tap-highlight-color: rgba(17, 24, 39, 0.08);
}

.black-mail-thread-item:hover {
    background: #f3f4f6;
}

.black-mail-thread-item:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.black-mail-thread-item.active {
    background: #111827;
    color: #fff;
}

.black-mail-thread-item.active .black-mail-thread-item-subtitle,
.black-mail-thread-item.active .black-mail-thread-item-preview,
.black-mail-thread-item.active .black-mail-thread-item-time,
.black-mail-thread-item.active .black-mail-thread-item-metrics {
    color: rgba(255, 255, 255, 0.82);
}

.black-mail-thread-item.active .black-mail-thread-item-metrics span {
    background: rgba(255, 255, 255, 0.12);
}

.black-mail-thread-item-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.black-mail-thread-item-title-line {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.black-mail-thread-mention-at {
    flex-shrink: 0;
    font-weight: 800;
    font-size: 0.95rem;
    color: #111827;
    line-height: 1;
}

.black-mail-thread-item.active .black-mail-thread-mention-at {
    color: #fff;
}

.black-mail-thread-item-title-mentioned {
    color: #111827;
    text-decoration: underline;
    text-decoration-color: #9ca3af;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.black-mail-thread-item.active .black-mail-thread-item-title-mentioned {
    color: #fff;
}

.black-mail-thread-item-title {
    flex: 1;
    min-width: 0;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111827;
}

/* Явный цвет: иначе #111827 у .title перебивает color у .active (тёмный фон). */
.black-mail-thread-item.active .black-mail-thread-item-title {
    color: #fff;
}

.black-mail-thread-item-time,
.black-mail-thread-item-subtitle {
    color: #64748b;
    font-size: 0.85rem;
}

.black-mail-thread-item-preview {
    color: #334155;
    font-size: 0.92rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.black-mail-thread-item-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: #64748b;
}

.black-mail-thread-item-metrics span {
    background: #f8fafc;
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
}

.black-mail-thread-item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.black-mail-inline-badge,
.black-mail-kind-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 700;
}

.black-mail-chat-panel {
    min-width: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Атрибут hidden: класс .black-mail-chat-empty с display:flex перекрывал UA [hidden], плейсхолдер не скрывался */
.black-mail-chat-empty[hidden],
.black-mail-chat[hidden],
.black-mail-reply-bar[hidden],
.black-mail-react-menu[hidden],
.black-mail-react-menu-full[hidden] {
    display: none !important;
}

.black-mail-chat-panel.black-mail-has-thread .black-mail-chat-empty {
    display: none !important;
}

.black-mail-chat-empty,
.black-mail-chat {
    flex: 1;
    min-height: 0;
}

.black-mail-chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.black-mail-chat-empty-card {
    max-width: 28rem;
    text-align: center;
    padding: 2rem;
    border: 1px dashed #cbd5e1;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.7);
}

.black-mail-chat {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.black-mail-chat-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
}

.black-mail-chat-header-main {
    flex: 1;
    min-width: 0;
}

.black-mail-chat-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.black-mail-chat-title-block {
    flex: 1;
    min-width: 0;
}

.black-mail-chat-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.black-mail-chat-title-row h2 {
    margin: 0;
    font-size: 1.25rem;
}

.black-mail-courier-metrics {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
}

.black-mail-courier-metrics .bm-metric-pill {
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    white-space: nowrap;
}

.black-mail-thread-city-line {
    margin: 0.2rem 0 0 0;
    font-size: 0.9rem;
}

.black-mail-thread-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.black-mail-chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem 0;
    flex-shrink: 0;
}

.black-mail-messages-wrap {
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: stretch;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.black-mail-messages-wrap > .black-mail-message-list {
    flex: 1 1 auto;
    min-width: 0;
}

.black-mail-mention-rail {
    flex: 0 0 auto;
    width: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.35rem;
    border-left: 1px solid #e5e7eb;
    background: #f8fafc;
}

.black-mail-mention-rail-btn {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 1px solid #111827;
    background: #111827;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.black-mail-mention-rail-btn:hover {
    background: #1f2937;
}

.black-mail-mention-rail-count {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.2rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.black-mail-message-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #9ca3af #e5e7eb;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.black-mail-message-list::-webkit-scrollbar {
    width: 12px;
}

.black-mail-message-list::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 999px;
}

.black-mail-message-list::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 999px;
    border: 2px solid #e5e7eb;
}

.black-mail-message-list::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.black-mail-message {
    display: flex;
    width: 100%;
}

.black-mail-message-row {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    max-width: min(44rem, 100%);
    flex: 0 1 auto;
}

.black-mail-message.me .black-mail-message-row {
    margin-left: auto;
    flex-direction: row-reverse;
}

.black-mail-message.other .black-mail-message-row {
    margin-right: auto;
}

.black-mail-bubble-wrap {
    flex: 0 0 auto;
    max-width: min(56rem, 92%);
    min-width: 0;
}

.black-mail-message-hover-actions {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-shrink: 0;
    padding-bottom: 0.2rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.black-mail-message:hover .black-mail-message-hover-actions,
.black-mail-message:focus-within .black-mail-message-hover-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media (hover: none) {
    .black-mail-message-hover-actions {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
}

.black-mail-msg-action-btn {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.45rem;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.12s, color 0.12s;
}

.black-mail-msg-action-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.black-mail-quote-preview {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    padding: 0.35rem 0.55rem;
    margin-bottom: 0.45rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 0.4rem;
    cursor: pointer;
    font: inherit;
    color: inherit;
    box-sizing: border-box;
}

.black-mail-quote-preview:hover {
    background: rgba(255, 255, 255, 0.11);
}

.black-mail-quote-preview-author {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #e5e7eb;
}

.black-mail-quote-preview-body {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.78);
    margin-top: 0.12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.black-mail-message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
    margin-top: 0.4rem;
}

.black-mail-reaction-chip {
    font-size: 0.8rem;
    line-height: 1.2;
    font-family: inherit;
    background: rgba(15, 23, 42, 0.08);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    color: #111827;
    border: 1px solid rgba(15, 23, 42, 0.08);
    cursor: pointer;
}

.black-mail-reaction-chip--me {
    background: #111827;
    color: #fff;
    border: 1px solid #111827;
}

.black-mail-reaction-chip:hover {
    filter: brightness(0.95);
}

.black-mail-message--highlight {
    animation: bm-msg-highlight 1.25s ease;
}

@keyframes bm-msg-highlight {
    0%,
    100% {
        filter: none;
    }

    25% {
        box-shadow: 0 0 0 3px #facc15;
        border-radius: 0.75rem;
    }
}

.black-mail-reply-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.45rem;
    background: #f8fafc;
    border: 1px solid #dbe2ea;
    border-radius: 0.8rem;
    font-size: 0.84rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.black-mail-reply-bar > .btn {
    margin-left: auto;
    align-self: center;
    flex-shrink: 0;
    background: transparent;
    border-color: transparent;
    color: #6b7280;
}

.black-mail-reply-bar-inner {
    display: flex;
    border-left: 3px solid #9ca3af;
    padding-left: 0.65rem;
    min-width: 0;
    flex: 1;
}

.black-mail-reply-bar-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #111827;
    font-size: 0.88rem;
    font-weight: 500;
}

.black-mail-react-menu {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10060;
    width: min(22rem, calc(100vw - 16px));
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
    overflow: hidden;
}

.black-mail-react-menu-quick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem;
}

.black-mail-emoji-choice--quick {
    font-size: 1.35rem;
    padding: 0.2rem 0.35rem;
}

.black-mail-react-menu-more {
    font-weight: 800;
    font-size: 1rem;
    min-width: 2.8rem;
    color: #111827;
    border: 1px dashed #9ca3af !important;
}

.black-mail-react-menu-full {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.35rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 0.15rem;
}

.black-mail-message.system {
    justify-content: center;
}

.black-mail-message.me {
    justify-content: flex-end;
}

.black-mail-message.other {
    justify-content: flex-start;
}

.black-mail-bubble {
    position: relative;
    width: fit-content;
    max-width: 100%;
    border-radius: 1.15rem;
    padding: 0.8rem 0.95rem 1.15rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.black-mail-message-relative-time {
    position: absolute;
    right: 0.65rem;
    bottom: 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #94a3b8;
    pointer-events: none;
    user-select: none;
}

.black-mail-message.me .black-mail-message-relative-time {
    color: rgba(255, 255, 255, 0.55);
}

.black-mail-message.other .black-mail-message-relative-time {
    color: #64748b;
}

.black-mail-message.me .black-mail-bubble {
    background: #111827;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-right-radius: 0.35rem;
}

.black-mail-message.other .black-mail-bubble {
    background: #fff;
    color: #111827;
    border: 1px solid #d1d5db;
    border-bottom-left-radius: 0.35rem;
}

.black-mail-message.pending {
    opacity: 0.72;
}

.black-mail-message-system {
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.88rem;
}

.black-mail-message-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
    color: #6b7280;
}

.black-mail-message-body {
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: anywhere;
    hyphens: none;
    color: #0f172a;
}

.black-mail-message.me .black-mail-message-head,
.black-mail-message.me .black-mail-message-body,
.black-mail-message.me .black-mail-quote-preview-author,
.black-mail-message.me .black-mail-quote-preview-body {
    color: #fff;
}

.black-mail-message.other .black-mail-quote-preview {
    background: #f3f4f6;
}

.black-mail-message.other .black-mail-quote-preview:hover {
    background: #e5e7eb;
}

.black-mail-message.other .black-mail-quote-preview-author {
    color: #111827;
}

.black-mail-message.other .black-mail-quote-preview-body {
    color: #4b5563;
}

.black-mail-message.me .black-mail-reaction-chip {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
}

.black-mail-message.me .black-mail-reaction-chip--me {
    background: #fff;
    color: #111827;
    border-color: #fff;
}

.black-mail-message-body.black-mail-message-body--html {
    white-space: normal;
}

.black-mail-message-body .bm-mention {
    color: #1d4ed8;
    font-weight: 600;
    background: #dbeafe;
    padding: 0 0.2em;
    border-radius: 0.25em;
}

.black-mail-message.me .black-mail-message-body .bm-mention {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.black-mail-message-body mark,
.black-mail-thread-item-preview mark {
    background: #fde68a;
    color: inherit;
    border-radius: 0.2rem;
    padding: 0 0.12rem;
}

.black-mail-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.black-mail-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    border-radius: 0.7rem;
    background: rgba(15, 23, 42, 0.06);
    color: #1d4ed8;
    text-decoration: none;
    font-size: 0.88rem;
}

.black-mail-attachment-image-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: min(100%, 280px);
}

.black-mail-chat-thumb {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.06);
    cursor: zoom-in;
    display: block;
}

.black-mail-message.me .black-mail-chat-thumb {
    background: rgba(255, 255, 255, 0.14);
}

.black-mail-attachment-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.black-mail-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.black-mail-photo-lightbox[hidden] {
    display: none !important;
}

.black-mail-photo-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
    cursor: pointer;
}

.black-mail-photo-lightbox-inner {
    position: relative;
    z-index: 1;
    max-width: min(96vw, 1200px);
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.black-mail-photo-lightbox-img {
    max-width: 100%;
    max-height: calc(96vh - 5rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    cursor: default;
}

.black-mail-photo-lightbox-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.black-mail-message-pending {
    margin-top: 0.45rem;
    color: #64748b;
    font-size: 0.82rem;
}

.black-mail-composer {
    border-top: 1px solid #e5e7eb;
    padding: 0.85rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(248, 250, 252, 0.98);
    flex-shrink: 0;
    position: relative;
}

.black-mail-composer-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.35rem 0.45rem 0.35rem 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.black-mail-composer-bar .black-mail-composer-field-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}

.black-mail-composer-bar textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    min-height: 2.25rem;
    max-height: 8rem;
    line-height: 1.4;
    padding: 0.45rem 0.5rem;
    font-size: 0.95rem;
    outline: none;
    box-shadow: none;
}

.black-mail-composer-bar textarea.black-mail-body--reply {
    color: #0f172a;
}

.black-mail-composer-icon-btn,
.black-mail-composer-plus-btn {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.black-mail-composer-icon-btn:hover,
.black-mail-composer-plus-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.black-mail-composer-plus-btn {
    font-size: 1.6rem;
    font-weight: 300;
    padding-bottom: 2px;
}

.black-mail-composer-send-btn {
    flex-shrink: 0;
    width: 2.45rem;
    height: 2.45rem;
    border: none;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

.black-mail-composer-send-btn:hover:not(:disabled) {
    background: #1f2937;
}

.black-mail-composer-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.black-mail-composer-hint {
    margin: 0;
    font-size: 0.75rem;
}

.black-mail-send-status-line {
    font-size: 0.82rem;
    min-height: 1rem;
}

.black-mail-emoji-popover {
    position: absolute;
    bottom: calc(100% - 0.25rem);
    left: 0.5rem;
    right: 0.5rem;
    max-width: min(100%, 22rem);
    z-index: 40;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    max-height: 14rem;
    overflow: hidden;
}

.black-mail-emoji-popover[hidden] {
    display: none !important;
}

.black-mail-emoji-popover-inner {
    padding: 0.5rem;
    max-height: 14rem;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    align-content: flex-start;
}

.black-mail-emoji-choice {
    border: none;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 6px;
}

.black-mail-emoji-choice:hover {
    background: #f1f5f9;
}

.black-mail-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    align-self: flex-start;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0f172a;
}

/* Пока файл не выбран — не перекрывать атрибут hidden правилом display: inline-flex */
.black-mail-file-chip[hidden] {
    display: none !important;
}

.black-mail-file-chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
}

@media (max-width: 980px) {
    .black-mail-layout {
        grid-template-columns: 1fr;
    }

    .black-mail-sidebar {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        max-height: 40vh;
    }

    .black-mail-message-list {
        min-height: 22rem;
    }
}

/* Black Mail: телефон — список чатов ↔ экран чата, гармошка категорий */
@media (min-width: 769px) {
    .black-mail-kind-mobile-bar {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .black-mail-shell {
        max-height: none;
        min-height: calc(100dvh - 5rem);
    }

    .black-mail-shell-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .black-mail-shell-subtitle {
        display: none;
    }

    .black-mail-kind-area {
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 0.35rem;
    }

    .black-mail-kind-mobile-bar {
        display: flex;
        padding: 0 1rem 0.5rem;
    }

    .black-mail-kind-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 0.5rem;
        padding: 0.65rem 0.9rem;
        border-radius: 0.85rem;
        border: 1px solid #cbd5e1;
        background: #fff;
        font: inherit;
        font-weight: 700;
        color: #0f172a;
        cursor: pointer;
    }

    .black-mail-kind-mobile-chevron {
        font-size: 0.75rem;
        opacity: 0.65;
    }

    .black-mail-kind-area:not(.is-open) .black-mail-top-tabs {
        display: none;
    }

    .black-mail-kind-area.is-open .black-mail-top-tabs {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding: 0 1rem 0.75rem;
        border-bottom: none;
    }

    .black-mail-layout {
        grid-template-columns: 1fr;
        min-height: 0;
        flex: 1;
    }

    .black-mail--mobile.black-mail--mobile-list .black-mail-sidebar {
        display: flex;
        flex-direction: column;
        min-height: 0;
        max-height: none;
        border-right: none;
        border-bottom: none;
        flex: 1;
    }

    .black-mail--mobile.black-mail--mobile-list .black-mail-chat-panel {
        display: none !important;
    }

    .black-mail--mobile.black-mail--mobile-chat .black-mail-sidebar {
        display: none !important;
    }

    .black-mail--mobile.black-mail--mobile-chat .black-mail-chat-panel {
        display: flex !important;
        flex-direction: column;
        min-height: 0;
        width: 100%;
        flex: 1;
    }

    .black-mail--mobile .black-mail-chat {
        min-height: 0;
        flex: 1;
    }

    .black-mail--mobile .black-mail-message-hover-actions {
        display: none !important;
    }

    .black-mail-mobile-back {
        flex-shrink: 0;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 0.75rem;
        border: 1px solid #cbd5e1;
        background: #fff;
        font-size: 1.25rem;
        line-height: 1;
        cursor: pointer;
        color: #111827;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.35rem;
    }

    .black-mail-chat-header {
        align-items: center;
    }

    .black-mail--mobile .black-mail-messages-wrap {
        flex-direction: column;
    }

    .black-mail--mobile .black-mail-mention-rail {
        flex-direction: row;
        width: 100%;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        padding: 0.5rem 0.75rem;
        justify-content: flex-end;
        align-items: center;
    }

    .black-mail-message-list {
        min-height: 0;
        padding: 0.75rem 0.85rem;
        -webkit-overflow-scrolling: touch;
    }

    .black-mail--mobile .black-mail-composer {
        padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
    }
}

