/* ===== Страница Инициативы ===== */
.initiatives-section { padding: 2rem 0 3rem; }
.initiatives-section .section-title { margin-bottom: 24px; }
.initiatives-header { display: flex; justify-content: flex-end; margin-bottom: 1.25rem; }

.initiatives-table-wrap { overflow-x: auto; box-shadow: 0 2px 12px rgba(0,0,0,.08); border-radius: 12px; background: #fff; }
.initiatives-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.initiatives-table th {
  text-align: left; padding: 14px 16px; background: #eef5ff; color: #0342a0;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.initiatives-table td { padding: 14px 16px; border-top: 1px solid #e8eef7; vertical-align: top; }
.initiative-row { cursor: pointer; }
.initiative-row:hover td { background: #f7faff; }
.col-open { width: 44px; }

.initiative-toggle {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid #c9d8ef; background: #fff;
  color: #0342a0; font-size: 18px; line-height: 1; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: transform .2s ease, background .2s ease;
  padding: 0;
}
.initiative-toggle[aria-expanded="true"] { transform: rotate(45deg); background: #0342a0; color: #fff; border-color: #0342a0; }
/* базовая тема задаёт * { color: #333 } — прямое правило на span перебивает наследование */
.initiative-toggle .initiative-toggle-icon { color: inherit; }

.initiative-name { font-weight: 600; color: #10265c; }
.initiative-developer { color: #6b7a90; font-size: .85rem; margin-top: 2px; }
.initiative-details-row { display: none; }
.initiative-details-row.is-open { display: table-row; }
.initiative-details {
  background: #f4f8ff; border-radius: 10px; padding: 14px 18px; margin: 0 4px 8px;
  display: flex; gap: 20px; align-items: flex-start; justify-content: space-between;
}
.initiative-details-text { flex: 1 1 auto; min-width: 0; }
.initiative-details-aside { flex: none; padding-top: 2px; }
.initiative-feedback-btn { white-space: nowrap; padding: 10px 20px; font-size: 14px; }
.initiative-details-title { font-weight: 600; color: #0342a0; margin-bottom: 6px; }
.initiative-details p { margin: 0 0 8px; }
.initiatives-empty { padding: 2.5rem; text-align: center; color: #6b7a90; background: #f7faff; border-radius: 12px; }

/* Цвета бейджей статусов */
.badge-gray { background: #eceff3; color: #57616e; }
.badge-cyan { background: #e3f2fd; color: #0277bd; }
.badge-green { background: #e6f6ec; color: #1e7e46; }

/* ===== Модальная форма (компактная) ===== */
#initiative_modal .form-content { max-width: 640px; width: min(94vw, 640px); }
.initiative-form-head h4 { margin: 0 0 4px; font-size: 1.25rem; }
.initiative-form-head p { margin: 0 0 14px; color: #57616e; font-size: .9rem; }
.initiative-form { max-height: 72vh; overflow-y: auto; padding-right: 6px; }
.ii-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.ii-field { display: flex; flex-direction: column; }
.ii-field-full { grid-column: 1 / -1; }
.ii-field label { font-size: .82rem; font-weight: 600; color: #2b3a55; margin-bottom: 4px; }
.ii-field input, .ii-field select, .ii-field textarea {
  border: 1px solid #c9d8ef; border-radius: 8px; padding: 8px 10px; font-size: .95rem; width: 100%;
  background: #fff; font-family: inherit;
}
.ii-field textarea { resize: vertical; min-height: 84px; }
.ii-field input:focus, .ii-field select:focus, .ii-field textarea:focus {
  outline: none; border-color: #0342a0; box-shadow: 0 0 0 3px rgba(3,66,160,.12);
}
.ii-inline { display: flex; gap: 8px; }
.ii-inline select { flex: 1; }
.ii-error { color: #c62828; font-size: .78rem; min-height: 0; margin-top: 3px; }
.ii-error:not(:empty) { margin-bottom: 2px; }
.ii-honey { position: absolute !important; left: -9999px; height: 1px; width: 1px; opacity: 0; }
.ii-submit { margin-top: 14px; width: 100%; }
.ii-submit[disabled] { opacity: .6; cursor: wait; }
.ii-success { text-align: center; padding: 24px 8px 8px; }
.ii-success-icon {
  width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; background: #1e7e46;
  color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center;
}
.ii-success-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.ii-success-text { color: #57616e; font-size: .92rem; }
.initiative-form.is-sent .ii-grid,
.initiative-form.is-sent .ii-submit { display: none; }
.initiative-form.is-sent .ii-success { display: block; }
.ii-success { display: none; }

/* Модалка поверх страницы */
#initiative_modal { z-index: 1260; }

/* ===== Мобильная адаптация ===== */
@media (max-width: 767px) {
  .initiatives-header { margin-bottom: 1rem; }
  .initiatives-header .btn {
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
  }

  /* Таблица -> карточки */
  .initiatives-table-wrap { overflow-x: visible; }
  .initiatives-table { min-width: 0; border: none; background: transparent; }
  .initiatives-table thead { display: none; }
  .initiatives-table tbody {
    display: block;
    margin-bottom: 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(16, 38, 92, 0.08);
    overflow: hidden;
  }
  .initiatives-table tbody tr {
    display: block;
    padding: 14px 16px;
  }
  .initiatives-table tbody tr td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: none;
    padding: 4px 0;
  }
  .initiatives-table tbody tr td.col-open {
    position: absolute;
    top: 14px; right: 14px;
  }
  .initiatives-table tbody tr { position: relative; padding-top: 16px; }
  .initiatives-table tbody tr td.col-name {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding-right: 56px;
  }
  .initiatives-table tbody tr td::before {
    content: attr(data-label);
    flex: none;
    font-size: .75rem;
    color: #6b7a90;
    font-weight: 500;
  }
  .initiatives-table tbody tr td.col-open::before { content: ''; }
  .initiatives-table tbody tr td.col-status::before { content: 'Статус решения'; }
  .initiatives-table tbody tr td.col-status .card-badge { white-space: nowrap; }
  .initiatives-table tbody tr td.col-name::before { content: ''; }

  .initiative-details-row { display: none !important; }
  .initiative-details-row.is-open { display: block !important; }
  .initiative-details-row td { display: block; padding: 0 16px 14px; }
  .initiative-details { display: block; }
  .initiative-feedback-btn { width: 100%; margin-top: 12px; }
  .initiative-group.is-open .initiative-details { display: block; }

  /* Модалка формы на всю ширину экрана */
  #initiative_modal .form-content {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    min-height: 100%;
    margin: 0;
    border-radius: 0;
    padding: 20px 18px;
  }
  .ii-grid { grid-template-columns: 1fr; }
  .ii-inline { flex-direction: row; }
}

/* Очень узкие экраны: форма инициативы в одну колонку */
@media (max-width: 560px) {
  .ii-grid { grid-template-columns: 1fr; gap: 6px 0; }
  .ii-inline { gap: 8px; }
  .ii-field input, .ii-field select, .ii-field textarea { font-size: 16px; }
}
