/* Только новые классы грантового сервиса. Базовый дизайн взят напрямую
   из parent-chats/static/style.css (Навигаторы детства). */

/* Общая навигация без изменения фирменной шапки */
.grant-topnav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0 2px;
    margin: -5px 0 19px;
    font-size: 13px;
}
.grant-topnav form { margin: 0; }
.grant-link-button {
    border: 0; padding: 0; background: transparent;
    color: var(--purple); font: inherit; font-weight: 700;
    cursor: pointer;
}
.grant-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin: 24px 4px 0;
    color: var(--muted);
    font-size: 12px;
}
.grant-footer a { color: var(--purple); text-decoration: none; font-weight: 650; }
.grant-footer a:hover, .grant-link-button:hover { text-decoration: underline; }
.grant-error { background: #fff0ee; color: #8c2a2a; border-color: #f3d1d1; }

/* Страница выбора МК повторяет существующий person-picker */
input:not([type]), input[type="search"], input[type="password"], input[type="date"], input[type="file"] {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 16px;
}
.grant-person-option strong,
.grant-person-option span { display: block; }
.grant-person-option strong { font-size: 15px; }
.grant-person-option span { margin-top: 4px; font-size: 12px; color: var(--muted); }
.grant-person-option:hover span { color: var(--purple); }
.grant-info-grid { grid-template-columns: minmax(0, 1fr); }
.grant-info-grid strong { font-size: 16px; font-weight: 750; }
.grant-intro { margin: -6px 0 22px; line-height: 1.55; color: var(--muted); }
.grant-subtle, .grant-muted { color: var(--muted); }
.grant-subtle { display: block; font-size: 12px; line-height: 1.45; margin-top: 5px; }
.grant-list-card { margin-top: 18px; }
.grant-actions { margin-top: 18px; }
.grant-table-heading { padding: 16px 12px 6px; }
.grant-table-heading .section-kicker { margin-bottom: 0; }
.production-table .production-org-name { min-width: 185px; }
.production-table td { overflow-wrap: anywhere; }

/* Статусы в таблице в цветовом коде родительских чатов */
.grant-pill, .grant-proof {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f2eef3;
    color: #736b77;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}
.grant-pill.won, .grant-proof.confirmed { background: #eaf7ee; color: #26743e; }
.grant-pill.awaiting_result, .grant-pill.submitted { background: #fff4d9; color: #806018; }
.grant-pill.not_supported, .grant-pill.not_admitted, .grant-pill.withdrawn { background: #fff0f0; color: #a0343d; }
.grant-proof { white-space: normal; }

/* Сохранение внешнего вида форм родительских чатов */
.grant-application { display: block; }
.grant-section { margin-top: 18px; margin-bottom: 18px; }
.grant-section h2 { margin: 7px 0 18px; font-size: 22px; line-height: 1.35; }
.grant-section .field { margin-top: 0; min-width: 0; }
.grant-section .form-grid { align-items: start; row-gap: 22px; }
.grant-section .field > label:not(.checklabel) {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
}
.grant-section .field input,
.grant-section .field select,
.grant-section .field textarea { max-width: 100%; }
.grant-section .field small {
    display: block;
    margin-top: 7px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}
.grant-section .field .checklabel { display: flex; gap: 11px; align-items: flex-start; font-weight: 700; line-height: 1.45; }
.grant-section .field .checklabel input { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--purple); }
.grant-section .full { grid-column: 1 / -1; }
.grant-section .btnrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.grant-section .button { margin: 0; }
.grant-notes textarea { min-height: 105px; }
.grant-application input:focus, .grant-application select:focus,
.grant-application textarea:focus, #personSearch:focus { border-color: var(--purple); outline: none; box-shadow: 0 0 0 3px rgba(124, 60, 157, .12); }

/* Админка: типографика и метрики из существующего admin-раздела */
.grant-admin-title { margin: 10px 0 22px; }
.grant-admin-nav { margin-top: 0; }
.grant-admin-nav a.active { background: #f5edf8; color: var(--purple); }
.grant-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 15px;
    margin-bottom: 22px;
}
.grant-filter .field { margin: 0; flex: 0 1 190px; min-width: 145px; }
.grant-filter .field label { font-size: 13px; font-weight: 750; display: block; margin-bottom: 7px; }
.grant-filter .button { margin: 0; }
.grant-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.grant-stat { min-width: 0; padding: 19px; }
.grant-stat .grant-muted { display: block; min-height: 36px; font-size: 13px; line-height: 1.3; }
.grant-stat .grant-big {
    display: block;
    margin: 9px 0;
    color: var(--purple);
    font-size: 28px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.grant-stat .grant-subtle { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.grant-login { max-width: 570px; }
.grant-login .field { margin-top: 0; }
.grant-login .form-description { margin-bottom: 26px; }
.admin-page .production-table-wrap { max-width: 100%; }
.admin-page .form-card { margin-bottom: 18px; }
.admin-page .production-table th, .admin-page .production-table td { vertical-align: top; }
.admin-page .production-table td { font-size: 13px; }
.admin-page .form-card > h2 { margin-top: 0; }
.admin-page .production-table { min-width: 600px; }

@media (max-width: 760px) {
    .grant-topnav { justify-content: flex-start; }
    .grant-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grant-stats .grant-big { font-size: 24px; }
    .grant-filter { gap: 13px; }
    .grant-filter .field { flex: 1 1 160px; }
    .grant-section .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .grant-metrics { grid-template-columns: 1fr; }
    .grant-filter .button { width: 100%; }
    .grant-section .btnrow .button { flex: 1 1 100%; }
    .grant-footer { justify-content: center; text-align: center; }
}

/* Разделение основной статистики и казённых учреждений */
.grant-block-title { margin: 28px 0 16px; font-size: 21px; font-weight: 800; color: var(--text); }
.grant-block-title:first-of-type { margin-top: 16px; }
