@import url("ui-feedback.css");

.admin-page-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.llm-settings-form .modal-field {
    margin-bottom: 14px;
}

.llm-settings-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.llm-test-block {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.admin-test-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.llm-test-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 10px;
    resize: vertical;
}

.llm-test-result.hidden {
    display: none;
}

.admin-layout {
    flex: 1;
    display: flex;
    min-height: 0;
    width: 100%;
}

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid var(--border);
    padding: 16px 0;
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.admin-nav-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
}

.admin-nav-item:hover {
    background: #e2e8f0;
}

.admin-nav-item.is-active {
    background: var(--accent);
    color: #fff;
}

.admin-content {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 32px;
    overflow: auto;
}

.admin-panel {
    display: none;
    height: 100%;
}

.admin-panel.is-active {
    display: block;
}

.admin-panel .admin-card {
    max-width: none;
}

.admin-subtitle {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}

.user-create-form {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.user-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.user-form-row .modal-field {
    flex: 1 1 160px;
    margin-bottom: 0;
}

.user-form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.users-table-wrap {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table th,
.users-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.users-table th {
    font-weight: 600;
    background: #f8fafc;
}

.user-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
}

.user-actions .admin-btn {
    padding: 6px 10px;
    font-size: 12px;
}

.admin-icon-btn {
    min-width: 34px;
    width: 34px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    text-align: center;
}

.admin-icon-btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    line-height: 1;
    pointer-events: none;
}

.admin-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 15px;
    cursor: pointer;
}

.admin-checkbox-label input {
    width: 18px;
    height: 18px;
}

.catalog-ui-settings-form .admin-actions {
    margin-bottom: 0;
}

.header-nav-auth {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.header-nav-user {
    font-size: 13px;
    color: var(--muted);
}

/* Стили кнопки «Выход» — в nav.css (button.header-nav-logout) */

.login-page-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.login-card-title {
    margin: 0 0 8px;
    font-size: 20px;
}

.login-card-desc {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.45;
}

.login-form .modal-field {
    margin-bottom: 14px;
}

.login-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.login-submit {
    width: 100%;
    margin-top: 8px;
}

.login-error {
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    font-size: 14px;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.login-error.hidden {
    display: none;
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .admin-sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .admin-nav-item {
        flex: 1 1 auto;
    }
}

.admin-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.admin-card-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 600;
}

.admin-card-desc {
    margin: 0 0 18px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.45;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
}

.admin-btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

button.admin-btn.admin-btn-secondary,
.admin-btn.admin-btn-secondary {
    background: #fff;
    color: var(--accent);
    border-color: var(--accent);
}

button.admin-btn.admin-btn-secondary:hover,
.admin-btn.admin-btn-secondary:hover {
    background: #f0fdfa;
    color: var(--accent);
}

button.admin-btn.admin-btn-danger,
.admin-btn.admin-btn-danger {
    background: #fff;
    color: #b91c1c;
    border-color: #fca5a5;
}

button.admin-btn.admin-btn-danger:hover,
.admin-btn.admin-btn-danger:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #f87171;
}

.content-table-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

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

.admin-file-label {
    cursor: pointer;
}

.admin-status {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    background: #ecfeff;
    border: 1px solid #a5f3fc;
}

.admin-status.hidden {
    display: none;
}

.admin-status.is-error {
    background: #fee2e2;
    border-color: #fca5a5;
}

.admin-index-panel {
    margin-top: 4px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.admin-index-label {
    font-size: 14px;
    font-weight: 500;
}

.admin-page .import-progress {
    margin: 16px 0 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.admin-page .import-progress-header {
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.admin-page .import-progress-meta {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
}

.import-pdf-options {
    margin: 16px 0 20px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 640px;
}

.import-pdf-options-title {
    font-size: 13px;
    font-weight: 600;
    padding: 0 6px;
}

.import-pdf-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0 0;
    font-size: 14px;
    cursor: pointer;
}

.import-pdf-option input {
    margin-top: 3px;
}

.admin-markup-field {
    margin-top: 16px;
    max-width: 280px;
}

.price-cleanup-form {
    margin-bottom: 16px;
}

.price-cleanup-query-field {
    max-width: 720px;
}

.price-cleanup-query-field input[type="search"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.price-cleanup-table {
    table-layout: fixed;
}

.price-cleanup-table th:nth-child(1),
.price-cleanup-table td:nth-child(1) {
    width: 90px;
}

.price-cleanup-table th:nth-child(4),
.price-cleanup-table td:nth-child(4) {
    width: 150px;
}

.price-cleanup-table th:nth-child(5),
.price-cleanup-table td:nth-child(5) {
    width: 120px;
}

.price-cleanup-description {
    max-width: 520px;
    white-space: pre-wrap;
    word-break: break-word;
}

.semantic-yaml-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
    resize: vertical;
    min-height: 300px;
}

.semantic-yaml-filter {
    max-width: 520px;
}

.semantic-yaml-filter input[type="search"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.semantic-yaml-table {
    table-layout: fixed;
}

.semantic-yaml-table th:nth-child(1),
.semantic-yaml-table td:nth-child(1) {
    width: 20%;
}

.semantic-yaml-table th:nth-child(2),
.semantic-yaml-table td:nth-child(2) {
    width: 23%;
}

.semantic-yaml-table th:nth-child(3),
.semantic-yaml-table td:nth-child(3) {
    width: 15%;
}

.semantic-yaml-table th:nth-child(4),
.semantic-yaml-table td:nth-child(4) {
    width: 9%;
}

.semantic-yaml-related {
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-field-hint {
    margin: 6px 0 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.content-admin-layout {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1100px) {
    .content-admin-layout {
        grid-template-columns: 1fr;
    }
}

.content-admin-list-header {
    margin-bottom: 12px;
}

.content-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.content-keywords-section-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.content-keywords-section-field {
    flex: 1 1 220px;
    margin-bottom: 0;
}

.content-keywords-section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #475569;
}

.content-keywords-section-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
}

.content-keywords-section-row .js-content-keywords-section-insert {
    flex-shrink: 0;
    margin-bottom: 2px;
}

.content-editor-block {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
}

.content-editor-label {
    display: block;
    font-weight: 600;
    margin: 8px 0 6px;
    font-size: 14px;
}

.content-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

/* Выше специфичность, чем catalog.css button { color: #fff; background: accent } */
.content-editor-toolbar button[type="button"] {
    min-width: 36px;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
}

.content-editor-toolbar button[type="button"]:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1f2937;
}

.content-editor-toolbar button[type="button"] b,
.content-editor-toolbar button[type="button"] i {
    color: inherit;
    font-weight: inherit;
    font-style: inherit;
}

.content-editor-html {
    min-height: 200px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    line-height: 1.5;
}

.content-editor-html:focus {
    outline: 2px solid #5eead4;
}

.js-content-markup {
    width: 100%;
    font-family: Consolas, monospace;
    font-size: 13px;
    margin-top: 6px;
}

.content-editor-markdown-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.site-settings-form .admin-actions {
    margin-top: 8px;
}

.admin-subsection-title {
    margin: 24px 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.admin-subsection-title:first-child {
    margin-top: 0;
}

.home-hero-settings {
    margin-bottom: 8px;
}

.home-hero-actions {
    margin-top: 4px;
}

.content-cover-field {
    margin: 16px 0;
    padding: 16px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #fff;
}

.content-cover-field.hidden {
    display: none;
}

.content-cover-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #64748b;
}

.content-cover-preview {
    margin-bottom: 12px;
}

.content-cover-preview img {
    max-width: 320px;
    max-height: 180px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    object-fit: cover;
}

.content-cover-preview.hidden {
    display: none;
}

.content-cover-field .admin-btn {
    margin-right: 8px;
    margin-top: 8px;
}

.content-editor-preview {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed #94a3b8;
    border-radius: 6px;
    background: #fff;
    max-height: 320px;
    overflow: auto;
}

.rag-reports-table .rag-report-query {
    max-width: 220px;
    word-break: break-word;
}

.rag-reports-table .rag-report-detail {
    max-width: 280px;
    font-size: 12px;
    color: #64748b;
    word-break: break-word;
}

.kb-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.kb-tabs .is-active {
    background: #2563eb;
    color: #fff;
}

.kb-panel {
    margin-top: 1rem;
}

.kb-admin-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.kb-admin-list-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.kb-search-input {
    flex: 1 1 240px;
    min-width: 200px;
    padding: 0.5rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
}

.kb-editor-panel {
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    padding: 1rem;
    background: #f8fafc;
}

.kb-editor-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.kb-form {
    margin-bottom: 0;
}

.kb-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.kb-table td:last-child {
    white-space: nowrap;
}

.admin-empty-cell {
    text-align: center;
    color: #64748b;
    padding: 1rem;
}
