/* =========================================================
   Модуль: База знаний / Цены / Доставка / Доборные
   ========================================================= */

.policy-top-btn {
    background: #111827 !important;
    color: #ffffff !important;
    border-color: #111827 !important;
    font-weight: 900 !important;
}

.policy-modal-box {
    width: min(1180px, calc(100vw - 26px)) !important;
    max-height: calc(100dvh - 28px) !important;
    overflow-y: auto !important;
    padding: 0 !important;
}

.policy-head {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 18px 20px 14px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 18px 18px 0 0;
}

.policy-head .modal-title {
    margin: 0 0 12px !important;
}

.policy-head h2 {
    margin: 0 !important;
}

.policy-head p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 13px;
}

.policy-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.policy-tabs button {
    border: 1px solid #dbe4ee;
    border-radius: 999px;
    padding: 8px 11px;
    background: #f8fafc;
    color: #111827;
    font-weight: 900;
    cursor: pointer;
    font-size: 12px;
}

.policy-tabs button.active {
    background: #d71920;
    border-color: #d71920;
    color: #ffffff;
}

.policy-body {
    padding: 16px 20px 22px;
}

.policy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.policy-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.policy-card {
    border: 1px solid #dbe4ee;
    border-radius: 16px;
    background: #ffffff;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(15,23,42,.05);
}

.policy-card h3 {
    margin: 0 0 10px;
    color: #111827;
    font-size: 18px;
}

.policy-card .hint,
.policy-muted {
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}

.policy-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.policy-form .full,
.policy-full {
    grid-column: 1 / -1;
}

.policy-form label {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
}

.policy-form input,
.policy-form select,
.policy-form textarea,
.policy-mini-filter input,
.policy-mini-filter select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #dbe4ee;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
    background: #ffffff;
}

.policy-form textarea {
    min-height: 88px;
    resize: vertical;
}

.policy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.policy-actions button,
.policy-btn {
    min-height: 36px;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    background: #d71920;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.policy-actions .light,
.policy-btn.light {
    background: #f8fafc;
    color: #111827;
    border: 1px solid #dbe4ee;
}

.policy-actions .danger,
.policy-btn.danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.policy-result {
    margin-top: 12px;
    border-radius: 14px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.policy-result.good {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.policy-result.warn {
    background: #fffbeb;
    border-color: #fde68a;
}

.policy-result.danger {
    background: #fef2f2;
    border-color: #fecaca;
}

.policy-result-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.policy-result-grid div {
    border-radius: 11px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 8px;
}

.policy-result-grid span {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    margin-bottom: 3px;
}

.policy-result-grid strong {
    color: #111827;
    font-size: 15px;
}

.policy-table-wrap {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-top: 10px;
}

.policy-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.policy-table th,
.policy-table td {
    padding: 8px;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    font-size: 12px;
    vertical-align: top;
}

.policy-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 900;
}

.policy-table td strong {
    color: #111827;
}

.policy-article-list {
    display: grid;
    gap: 9px;
}

.policy-article {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    background: #ffffff;
}

.policy-article h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.policy-article .cat {
    display: inline-flex;
    margin-bottom: 7px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 900;
}

.policy-article .text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #1f2937;
    font-size: 13px;
    line-height: 1.38;
}

.policy-mini-filter {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 8px;
    margin-bottom: 12px;
}

.policy-admin-section {
    margin-bottom: 14px;
}

.policy-admin-section summary {
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
    color: #111827;
    padding: 10px 0;
}

.policy-admin-section[open] summary {
    color: #d71920;
}

.policy-chip {
    display: inline-flex;
    padding: 4px 7px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 11px;
    font-weight: 900;
}

.policy-chip.green {
    background: #dcfce7;
    color: #166534;
}

.policy-chip.red {
    background: #fee2e2;
    color: #991b1b;
}

.policy-inline-edit-btn {
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    padding: 5px 8px;
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    margin-right: 4px;
}

@media (max-width: 950px) {
    .policy-modal-box {
        width: calc(100vw - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
    }

    .policy-head {
        padding: 12px;
    }

    .policy-body {
        padding: 12px;
    }

    .policy-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .policy-tabs button {
        width: 100%;
        font-size: 11px;
        padding: 8px 6px;
    }

    .policy-grid,
    .policy-grid-3,
    .policy-form,
    .policy-result-grid,
    .policy-mini-filter {
        grid-template-columns: 1fr;
    }

    .policy-table {
        min-width: 620px;
    }

    .policy-result-grid strong {
        font-size: 14px;
    }
}


/* Детальная ценовая политика */
.policy-table td:nth-child(5),
.policy-table td:nth-child(6),
.policy-table td:nth-child(7) {
    font-weight: 900;
}


/* Заголовок раздела ценовой политики с кнопкой добавления */
.policy-section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.policy-section-title-row h3 {
    margin-bottom: 4px !important;
}

.policy-section-title-row .policy-btn {
    white-space: nowrap;
}

@media (max-width: 950px) {
    .policy-section-title-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .policy-section-title-row .policy-btn {
        width: 100%;
    }
}


/* Встроенная форма администратора в базе знаний */
.policy-inline-admin-form {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 16px;
    background: #eff6ff;
}

.policy-inline-admin-form h3 {
    margin: 0 0 10px !important;
    color: #1e3a8a !important;
}

.policy-article .policy-actions {
    margin-top: 10px;
}


/* Ценовая политика: отдельные столбцы характеристик */
.policy-price-table {
    min-width: 1180px !important;
}

.policy-price-table td:nth-child(4),
.policy-price-table td:nth-child(9),
.policy-price-table td:nth-child(10),
.policy-price-table td:nth-child(11) {
    font-weight: 900;
}

.policy-price-table th:nth-child(4) {
    min-width: 92px;
}


/* Импорт файла ценовой политики */
.policy-import-actions {
    padding: 10px;
    border: 1px solid #fde68a;
    border-radius: 14px;
    background: #fffbeb;
}

.policy-import-actions .policy-btn.light,
.policy-import-actions a.policy-btn.light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}


/* Каскадные фильтры ценовой политики */
.policy-price-filters select {
    font-weight: 800;
}

.policy-price-filter-reset {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.policy-price-filter-reset .policy-btn {
    width: 100%;
}

.policy-filter-summary {
    margin-top: 12px !important;
    margin-bottom: 8px !important;
    padding: 8px 10px !important;
    font-size: 13px;
    font-weight: 800;
}

@media (max-width: 950px) {
    .policy-price-filter-reset label {
        display: none;
    }
}
