/* Карточка заявки. Все правила — внутри .rq, чтобы не задевать Bootstrap 3 остального сайта. */
.rq, .rq-journal, .rq-modal {
    --rq-bg: #f3f5f9;
    --rq-card: #fff;
    --rq-border: #d9dee7;
    --rq-text: #111827;
    --rq-muted: #4b5563;
    --rq-primary: #2563eb;
    --rq-primary-soft: #e8efff;
    --rq-success: #15803d;
    --rq-success-soft: #e7f6ec;
    --rq-warning: #b45309;
    --rq-warning-soft: #fdf3e2;
    --rq-danger: #dc2626;
    --rq-danger-soft: #fdecec;
    --rq-radius: 12px;
    --rq-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    color: var(--rq-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    margin: 0 0 24px;
}
.rq *, .rq *::before, .rq *::after { box-sizing: border-box; }
.rq a { color: var(--rq-primary); }
/* То, что наследуется от темы сайта и Bootstrap: шрифт и цвет заголовков, жирные label, шрифт полей ввода. */
.rq h1, .rq h2, .rq h3, .rq h4, .rq-journal h4 { font-family: inherit; color: var(--rq-text); text-shadow: none; }
.rq button, .rq input, .rq select, .rq textarea { font-family: inherit; }
.rq a:focus-visible, .rq button:focus-visible, .rq summary:focus-visible, .rq-journal a:focus-visible, .rq-journal button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px;
}
.rq-muted { color: var(--rq-muted); }
.rq [hidden], .rq-modal [hidden] { display: none !important; }
.rq-gap { margin-top: 12px; }

/* ---- Карточки и сетка ---- */
.rq-card {
    background: var(--rq-card);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius);
    box-shadow: var(--rq-shadow);
    padding: 24px 28px;
    margin-bottom: 20px;
}
.rq-card__title { font-size: 21px; font-weight: 700; line-height: 1.3; margin: 0 0 18px; }
.rq-card--notice { font-size: 17px; }
.rq-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.rq-grid .rq-card { margin-bottom: 0; }
.rq-grid { margin-bottom: 20px; }
.rq-grid__side { position: sticky; top: 16px; }
@media (max-width: 991px) {
    .rq-grid { grid-template-columns: 1fr; }
    .rq-grid__side { position: static; order: -1; }
}

/* ---- Шапка ---- */
.rq-head__title { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 14px; }
.rq-head__meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 26px; }
.rq-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 15px;
    color: #fff; background: var(--rq-primary);
}
.rq-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.rq-pill--success { background: var(--rq-success); }
.rq-pill--warning { background: var(--rq-warning); }
.rq-pill--danger { background: var(--rq-danger); }
.rq-pill--soft.rq-pill--warning { background: var(--rq-warning-soft); color: var(--rq-warning); }
.rq-pill--soft.rq-pill--danger { background: var(--rq-danger-soft); color: var(--rq-danger); }
.rq-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px; font-size: 15px;
    background: var(--rq-bg); color: var(--rq-text); border: 1px solid var(--rq-border);
}
.rq-chip--accent { background: var(--rq-warning-soft); color: var(--rq-warning); border-color: transparent; }

/* ---- Степпер этапов ---- */
.rq-steps { display: flex; list-style: none; margin: 0; padding: 0; counter-reset: none; }
.rq-step { flex: 1; position: relative; text-align: center; padding: 0 4px; }
.rq-step::before {
    content: ""; position: absolute; top: 18px; left: -50%; width: 100%; height: 4px;
    background: var(--rq-border); z-index: 0;
}
.rq-step:first-child::before { display: none; }
.rq-step--done::before, .rq-step--current::before { background: var(--rq-primary); }
.rq-step__dot {
    position: relative; z-index: 1;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: #fff; border: 2px solid var(--rq-border); color: var(--rq-muted);
    font-weight: 700; font-size: 16px;
}
.rq-step__label { display: block; margin-top: 8px; font-size: 15px; color: var(--rq-muted); line-height: 1.3; }
.rq-step--done .rq-step__dot { background: var(--rq-primary); border-color: var(--rq-primary); color: #fff; }
.rq-step--current .rq-step__dot { border-color: var(--rq-primary); color: var(--rq-primary); box-shadow: 0 0 0 4px var(--rq-primary-soft); }
.rq-step--current .rq-step__label { color: var(--rq-text); font-weight: 600; }
.rq-steps--stopped .rq-step--todo { opacity: .45; }
/* Процесс прерван: пунктир к конечному шагу, а не «пройденная» линия. */
.rq-step--terminal::before { background: repeating-linear-gradient(90deg, var(--rq-danger) 0 6px, transparent 6px 10px); }
.rq-step--terminal .rq-step__dot { background: var(--rq-danger); border-color: var(--rq-danger); color: #fff; }
.rq-step--terminal .rq-step__label { color: var(--rq-danger); font-weight: 600; }
@media (max-width: 600px) {
    /* На телефоне подписи не помещаются: оставляем только подпись текущего этапа (она же есть в шапке). */
    .rq-step__label { display: none; }
    .rq-step--current .rq-step__label, .rq-step--terminal .rq-step__label {
        display: block; position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 14px;
    }
    /* Последний шаг — подпись прижимаем вправо, чтобы не выходила за экран. */
    .rq-step:last-child .rq-step__label { left: auto; right: 0; transform: none; }
    .rq-step:first-child .rq-step__label { left: 0; transform: none; }
    .rq-steps { padding-bottom: 28px; }
    .rq-step { position: relative; }
    .rq-card { padding: 18px 16px; }
    .rq-head__title { font-size: 25px; }
    .rq-card__title { font-size: 19px; }
}

.rq-alert { margin-top: 22px; padding: 14px 18px; border-radius: 10px; font-weight: 500; }
.rq-alert i { margin-right: 6px; }
.rq-alert--success { background: var(--rq-success-soft); color: #11632e; }
.rq-alert--warning { background: var(--rq-warning-soft); color: #8a4b04; }
.rq-alert--danger { background: var(--rq-danger-soft); color: #9b1c1c; }

/* ---- Вкладки и свойства ---- */
.rq-tabs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: -4px 0 18px; padding: 0 0 12px; border-bottom: 1px solid var(--rq-border); }
.rq-tabs > li > a {
    display: block; padding: 10px 16px; border-radius: 10px; color: var(--rq-muted);
    text-decoration: none; font-weight: 600; font-size: 16px;
}
.rq-tabs > li > a:hover { background: var(--rq-bg); color: var(--rq-text); }
.rq-tabs > li.active > a { background: var(--rq-primary-soft); color: var(--rq-primary); }
.rq-props { margin: 0; }
.rq-props__row { display: grid; grid-template-columns: minmax(180px, 40%) 1fr; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid #eceff4; }
.rq-props__row:last-child { border-bottom: 0; }
.rq-props dt { font-weight: 500; color: var(--rq-muted); }
.rq-props dt, .rq-props dd { line-height: 1.45; }
.rq-props dd { margin: 0; font-weight: 500; word-break: break-word; }
.rq-props dd .rq-muted { font-weight: 400; }
@media (max-width: 600px) { .rq-props__row { grid-template-columns: 1fr; gap: 2px; } }
.rq-edit {
    display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
    width: 34px; height: 34px; margin-left: 6px; border-radius: 8px; font-size: 15px;
    color: var(--rq-muted) !important; text-decoration: none !important;
}
.rq-edit:hover { background: var(--rq-primary-soft); color: var(--rq-primary) !important; }
.rq-hint { cursor: pointer; margin-left: 4px; color: var(--rq-primary); }

/* ---- Что делать сейчас ---- */
.rq-now__text { margin: 0 0 16px; }
.rq-now__hint { font-size: 15px; color: var(--rq-muted); margin: 2px 0 0; }
.rq-now__primary, .rq-now__secondary { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.rq-now__primary:empty, .rq-now__secondary:empty { display: none; }
.rq-now__primary form { margin: 0; }
.rq-now__primary .rq-btn, .rq-now__secondary .rq-btn { width: 100%; }
.rq-now__tools:not(:has(*)) { display: none; }
.rq-now__tools { display: flex; flex-direction: column; gap: 4px; padding-top: 14px; border-top: 1px solid var(--rq-border); }
.rq-link { display: flex; align-items: center; min-height: 40px; padding: 4px 8px; margin: 0 -8px; border-radius: 8px; font-weight: 500; text-decoration: none !important; }
.rq-link:hover { background: var(--rq-primary-soft); }
.rq-link i { width: 22px; flex: none; text-align: center; margin-right: 8px; }

.rq-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 50px; padding: 11px 20px; border-radius: 10px; border: 1px solid #c5ccd8;
    background: #fff; color: var(--rq-text) !important; font-weight: 600; font-size: 17px; line-height: 1.25; text-align: center;
    text-decoration: none !important; cursor: pointer; transition: background .15s, border-color .15s;
}
.rq-btn:hover { background: var(--rq-bg); }
.rq-btn[disabled] { opacity: .55; cursor: not-allowed; }
.rq-btn--primary { background: var(--rq-primary); border-color: var(--rq-primary); color: #fff !important; }
.rq-btn--primary:hover { background: #1d4ed8; }
.rq-btn--success { background: var(--rq-success); border-color: var(--rq-success); color: #fff !important; }
.rq-btn--success:hover { background: #166534; }
.rq-btn--warning { background: var(--rq-warning-soft); border-color: #f0cf9d; color: #92400e !important; }
.rq-btn--warning:hover { background: #fbe8c8; }
.rq-btn--danger-outline { border-color: #eb9c9c; color: #b91c1c !important; }
.rq-btn--danger-outline:hover { background: var(--rq-danger-soft); }
.rq-btn--small { min-height: 42px; padding: 8px 16px; font-size: 16px; }

/* ---- Документы ---- */
.rq-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.rq-doc { border: 1px solid var(--rq-border); border-radius: 12px; padding: 18px 20px; background: #fff; }
.rq-doc--done { border-color: #bfe5cc; background: #f6fcf8; }
.rq-doc--partial { border-color: #f5d9a8; background: #fffbf3; }
.rq-doc__head { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; line-height: 1.3; margin-bottom: 12px; }
.rq-doc__icon { color: #9ca3af; font-size: 20px; }
.rq-doc--done .rq-doc__icon { color: var(--rq-success); }
.rq-doc--partial .rq-doc__icon { color: var(--rq-warning); }
.rq-doc__note { margin: -4px 0 8px; font-weight: 600; }
.rq-doc__files { list-style: none; margin: 0 0 8px; padding: 0; }
.rq-doc__files li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 5px 0; overflow-wrap: anywhere; }
.rq-doc__kind { font-size: 13px; font-weight: 700; color: var(--rq-muted); min-width: 40px; }
.rq-doc__upload summary { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 14px; margin-top: 4px; border: 1px solid #c5ccd8; border-radius: 10px; cursor: pointer; color: var(--rq-primary); font-weight: 600; list-style: none; }
.rq-doc__upload summary::-webkit-details-marker { display: none; }
.rq-doc__upload summary:hover { background: var(--rq-primary-soft); }
.rq-doc__upload[open] summary { margin-bottom: 12px; }
.rq-upload { display: flex; flex-direction: column; gap: 12px; }
.rq-upload__field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; margin: 0; }
.rq-upload__field span { font-size: 15px; color: var(--rq-muted); }
.rq input[type=file] { font-size: 15px; font-weight: 400; color: var(--rq-muted); max-width: 100%; }
.rq input[type=file]::file-selector-button {
    margin-right: 10px; padding: 9px 14px; border-radius: 8px; cursor: pointer; font: inherit;
    border: 1px solid #c5ccd8; background: #fff; color: var(--rq-text); font-weight: 600;
}
.rq input[type=file]::file-selector-button:hover { background: var(--rq-bg); }
.rq-inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.rq .form-control {
    height: 46px; padding: 10px 14px; border: 1px solid #c5ccd8; border-radius: 10px; box-shadow: none;
    font-size: 16px; color: var(--rq-text);
}
.rq textarea.form-control { height: auto; }
.rq .form-control:focus { border-color: var(--rq-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .2); }
.rq-sbyt-net { margin: 18px 0 0; }

/* ---- Все файлы ---- */
.rq-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 28px; }
.rq-files__group h3 { font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0 0 10px; }
.rq-files__list { list-style: none; margin: 0; padding: 0; }
.rq-files__list > li { padding: 12px 0; border-bottom: 1px solid #eceff4; overflow-wrap: anywhere; }
.rq-files__list ul { list-style: none; margin: 4px 0 0; padding: 0; }
.rq-files__list ul > li { padding: 3px 0; }
.rq-files__name { font-size: 15px; font-weight: 600; color: var(--rq-muted); line-height: 1.4; margin-bottom: 4px; }
.rq .desc-file { font-size: 14px; }
.rq-files__standard { margin-top: 12px; font-size: 15px; padding-top: 12px; border-top: 1px solid #eceff4; }
.rq-files__standard ul, .rq-files__standard li { list-style: none; margin: 0; padding: 0; }
.rq-files__standard li { padding: 4px 0; }
.rq-files__standard small { font-size: 14px; }
.rq-files__standard b, .rq-files__standard strong { font-weight: 600; color: var(--rq-muted); }

/* Статусы выгрузки в ИС (классы задаёт FileRepository, их же проверяет script.js) */
.rq .uploadFile { cursor: pointer; margin-left: 6px; padding: 4px; font-size: 17px; }
.rq .uploadComplete { color: var(--rq-success); }
.rq .uploadInProgress { color: #a9a939; }
.rq .uploadNotComplete { color: #6b7280; }
.rq .uploadError { color: var(--rq-danger); }
.rq .users .liUserSbyt i { color: var(--rq-danger); cursor: pointer; }

/* ---- Модалки (Bootstrap 3) ---- */
.rq-modal { color: var(--rq-text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.5; }
.rq-modal .form-control { height: 46px; padding: 10px 14px; border: 1px solid #c5ccd8; border-radius: 10px; box-shadow: none; font-size: 16px; color: var(--rq-text); }
.rq-modal textarea.form-control { height: auto; }
.rq-modal .form-control:focus { border-color: var(--rq-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .2); }
.rq-modal button, .rq-modal input, .rq-modal select, .rq-modal textarea { font-family: inherit; }
.rq-modal .modal-content { border-radius: 16px; border: 0; box-shadow: 0 24px 48px rgba(16, 24, 40, .22); }
.rq-modal .modal-header { padding: 20px 24px; border-bottom-color: var(--rq-border); }
.rq-modal .modal-title { font-size: 21px; font-weight: 700; line-height: 1.3; color: var(--rq-text); }
.rq-modal .close { font-size: 32px; line-height: 26px; opacity: .55; text-shadow: none; }
.rq-modal .close:hover { opacity: .9; }
.rq-modal .modal-body { padding: 20px 24px; }
.rq-modal .modal-footer { padding: 16px 24px; border-top-color: var(--rq-border); }
.rq-modal label { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.rq-modal textarea { resize: vertical; }
.rq-modal .btn, .rq-journal .btn {
    min-height: 46px; padding: 10px 20px; border-radius: 10px; font-size: 16px; font-weight: 600;
    box-shadow: none; text-shadow: none;
}
.rq-modal .btn-default, .rq-journal .btn-default { background: #fff; border-color: #c5ccd8; color: var(--rq-text); }
.rq-modal .btn-default:hover, .rq-journal .btn-default:hover { background: var(--rq-bg); }
.rq-modal .btn-primary, .rq-journal .btn-primary { background: var(--rq-primary); border-color: var(--rq-primary); color: #fff; }
.rq-modal .btn-primary:hover, .rq-journal .btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.rq-modal .btn-success { background: var(--rq-success); border-color: var(--rq-success); color: #fff; }
.rq-modal .btn-success:hover { background: #166534; border-color: #166534; }
.rq-modal .btn-warning { background: var(--rq-warning); border-color: var(--rq-warning); color: #fff; }
.rq-modal .btn-warning:hover { background: #92400e; border-color: #92400e; }
.rq-modal .btn-danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.rq-modal .btn-danger:hover { background: #991b1b; border-color: #991b1b; }
#body-prop li { overflow-wrap: break-word; }

/* Прелоадер распознавания счёта (script.js) */
.rq .preloader { position: relative; min-height: 120px; }
.rq .preloader__row { position: relative; margin: 10px auto; width: 50px; height: 50px; animation: rq-rotate 2s infinite linear; }
.rq .preloader__item {
    position: absolute; top: 0; left: 12px; width: 26px; height: 26px; border-radius: 50%;
    background: var(--rq-primary); animation: rq-bounce 2s infinite ease-in-out;
}
.rq .preloader__item:last-child { top: auto; bottom: 0; animation-delay: -1s; }
@keyframes rq-rotate { 100% { transform: rotate(360deg); } }
@keyframes rq-bounce { 0%, 100% { transform: scale(0); } 50% { transform: scale(1); } }

/* Плашки Flash внутри карточки */
.rq > .alert { border-radius: 10px; }

/* Журнал под карточкой (компонент my:news.list): таблица прокручивается внутри себя, страница — нет. */
#journal { display: block; width: 100%; max-width: 100%; overflow-x: auto; }
.rq-journal {
    background: #fff; border: 1px solid var(--rq-border); border-radius: var(--rq-radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    overflow: hidden; color: var(--rq-text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.rq-journal > .panel-heading { padding: 20px 28px 12px; background: #fff; border: 0; }
.rq-journal > .panel-heading h4 { margin: 0; font-size: 21px; font-weight: 700; }
.rq-journal #journal { margin: 0; font-size: 15px; line-height: 1.45; }
.rq-journal #journal > thead > tr > th {
    padding: 10px 16px; background: var(--rq-bg); border: 0; color: var(--rq-muted); font-size: 14px; font-weight: 600; white-space: nowrap;
}
/* Тип события — цветная полоса слева: заливка строк Bootstrap мешала читать текст. */
.rq-journal #journal > tbody > tr > td { padding: 14px 16px; background: #fff; border: 0; border-bottom: 1px solid #eceff4; color: var(--rq-text); vertical-align: top; }
.rq-journal #journal > tbody > tr:hover > td { background: #f8f9fc; }
.rq-journal #journal > tbody > tr > td:first-child { box-shadow: inset 4px 0 0 #cbd2dd; padding-left: 24px; }
.rq-journal #journal > tbody > tr.info > td:first-child { box-shadow: inset 4px 0 0 var(--rq-primary); }
.rq-journal #journal > tbody > tr.success > td:first-child { box-shadow: inset 4px 0 0 var(--rq-success); }
.rq-journal #journal > tbody > tr.warning > td:first-child { box-shadow: inset 4px 0 0 #d97706; }
.rq-journal #journal > tbody > tr.danger > td:first-child { box-shadow: inset 4px 0 0 var(--rq-danger); }
.rq-journal #journal > tbody > tr.purple > td:first-child { box-shadow: inset 4px 0 0 #7c3aed; }
.rq-journal #journal > tbody > tr > td a { color: var(--rq-primary); }
.rq-journal #journal > thead > tr > th:first-child { padding-left: 24px; }
.rq-journal #journal > tbody > tr > td:nth-child(2) { word-break: normal; overflow-wrap: normal; white-space: nowrap; }
.rq-journal > .panel-footer { padding: 16px 24px; background: #fff; border-top: 1px solid var(--rq-border); }
.rq-journal .pagination { margin: 0; }
.rq-journal .pagination > li > a, .rq-journal .pagination > li > span { padding: 10px 16px; font-size: 16px; }
.rq-journal .pagination > .active > a, .rq-journal .pagination > .active > span { background: var(--rq-primary); border-color: var(--rq-primary); }

/* Удаление файла из множественного слота */
.rq-doc__delete { margin-left: auto; }
.rq-icon-btn {
    border: 0; background: transparent; color: var(--rq-muted); cursor: pointer;
    width: 34px; height: 34px; border-radius: 8px; line-height: 1;
}
.rq-icon-btn:hover { background: var(--rq-danger-soft); color: var(--rq-danger); }

/* Кабинет заявителя */
.rq-link--danger { color: var(--rq-danger) !important; }
.rq-upload--inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.rq-upload--inline .form-control { flex: 1 1 220px; width: auto; }

/* Удаление своего документа заявителем */
.rq-file-del { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: 0 4px; border-radius: 8px; color: #b91c1c !important; text-decoration: none !important; }
.rq-file-del:hover { background: var(--rq-danger-soft); }

/* Ответственные операторы сбыта (модалка) */
.rq-team { list-style: none; margin: 0 0 12px; padding: 0; }
.rq-team li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid #eceff4; }
.rq-team__form { margin: 0; }
