/* ===== Модуль документов ===== */
.docs-module { max-width: 1200px; margin: 20px auto; font-family: sans-serif; padding: 0 15px; }
.docs-module h2 { margin-bottom: 20px; color: #333; border-bottom: 2px solid #4CAF50; padding-bottom: 10px; }

/* Выбор шаблона */
.tpl-select-wrap { margin-bottom: 20px; }
.tpl-select-wrap label { font-weight: 500; margin-right: 10px; }
#tplSelect { padding: 10px 15px; border: 1px solid #ddd; border-radius: 4px; min-width: 300px; font-size: 14px; }

/* Общие поля - на всю ширину */
#formFields .group-common {
    border: 2px solid #a6caf4;
    padding: 10px;
    border-radius: 5px;
}

#formFields .group-common textarea{
    resize:vertical;
    height: 42px;
}

/* Контейнер для двух колонок */
#formFields .groups-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}


@media (max-width: 900px) {
    #formFields .groups-row {
        grid-template-columns: 1fr;
    }
}

/* Карточка группы (Поставщик/Покупатель) */
.group-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.group-card h4 {
    margin: 0 0 15px !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #4CAF50 !important;
    font-size: 18px !important;
}
.h4-o {
    margin: 0 0 15px !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #4CAF50 !important;
    font-size: 18px !important;
}

/* Блок Checko автозаполнения */
.cheko-search-box {
    background: #e3f2fd;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    border-left: 4px solid #2196F3;
}

.cheko-search-box label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1976D2 !important;
    display: block !important;
    margin-bottom: 8px !important;
}

.cheko-search-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
}

.cheko-search-wrapper input {
    flex: 1;
    padding: 8px 12px !important;
    border: 1px solid #90caf9 !important;
    border-radius: 4px !important;
}

.cheko-search-wrapper .toggle-type {
    padding: 8px 12px !important;
    background: #fff;
    border: 1px solid #90caf9 !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 12px;
}

.cheko-results {
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 4px;
}

.cheko-result-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.cheko-result-item:hover {
    background: #e3f2fd;
}

.cheko-result-item strong {
    display: block;
    color: #1976D2;
    margin-bottom: 2px;
}

.cheko-result-item small {
    color: #666;
}

.cheko-result-item .cheko-inn {
    font-family: monospace;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

/* Поля внутри карточки */
.group-card .field-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Индикатор автозаполнения */
.field-autofilled {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { background: #fff; }
    50% { background: #c8e6c9; }
    100% { background: #fff; }
}

/* Таблица товаров */
#itemsBlock { margin: 20px 0; padding: 15px; background: #f9f9f9; border-radius: 8px; }
#itemsBlock h4 { margin: 0 0 12px; color: #333; }
#itemsTable { width: 100%; border-collapse: collapse; background: #fff; }
#itemsTable th { background: #4CAF50; color: #fff; padding: 10px; text-align: left; font-weight: 500; }
#itemsTable td { padding: 8px; border-bottom: 1px solid #eee; }
#itemsTable input { padding: 6px 8px; border: 1px solid #ddd; border-radius: 3px; }
#itemsTable .row-sum { font-weight: 600; color: #2e7d32; }
#itemsTable button { background: #f44336; color: #fff; border: none; border-radius: 4px; padding: 4px 10px; cursor: pointer; }
#itemsTable button:hover { background: #da190b; }

/* Кнопки */
#generateBtn { margin-top: 10px; padding: 12px 30px; background: #4CAF50; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 15px; font-weight: 500; transition: background 0.2s; }
#generateBtn:hover { background: #45a049; }
#generateBtn:disabled { background: #aaa; cursor: not-allowed; }

/* Список документов */
#docsList { margin-top: 30px; }
#docsList h3 { margin-bottom: 15px; color: #333; border-bottom: 2px solid #2196F3; padding-bottom: 10px; }
.doc-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; margin-bottom: 10px; }
.doc-item:hover { border-color: #2196F3; box-shadow: 0 2px 8px rgba(33,150,243,0.15); }
.doc-info { display: flex; flex-direction: column; gap: 4px; }
.doc-info a { color: #2196F3; text-decoration: none; font-weight: 500; }
.doc-info a:hover { text-decoration: underline; }
.doc-info small { color: #666; }
.doc-actions { display: flex; gap: 8px; align-items: center; }
.doc-actions select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.doc-actions .btn-download { padding: 6px 14px; background: #2196F3; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }
.doc-actions .btn-download:hover { background: #1976D2; }
.doc-actions .btn-delete { padding: 6px 14px; background: #fff; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }
.doc-actions .btn-delete:hover { background: #ffaba5ff; }
.doc-empty { color: #666; font-style: italic; padding: 20px; text-align: center; background: #f9f9f9; border-radius: 6px; }

/* Утилиты */
.hidden { display: none !important; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

#docNameWrap { 
  margin: 15px 0; 
  padding: 12px; 
  background: #f0f7ff; 
  border-radius: 6px; 
  border-left: 4px solid #2196F3;
}
#docNameWrap label { 
  font-weight: 500; 
  color: #333; 
  display: block; 
  margin-bottom: 6px;
}
#docNameWrap small { 
  display: block; 
  margin-top: 4px; 
  color: #666;
}

/* Чекбокс "Запомнить" в карточках поставщик/покупатель */
.remember-wrap{display:flex;align-items:center;gap:8px;margin:10px 0 12px;font-size:12px;color:#555}
.remember-wrap input{width:16px;height:16px;cursor:pointer}
.remember-clear{margin-left:auto;padding:3px 10px;font-size:11px;background:#f44336;color:#fff;border:none;border-radius:4px;cursor:pointer}
.remember-clear:hover{background:#d32f2f}
.field-highlight{animation:hl .4s ease;background:#e8f5e9}
@keyframes hl{from{background:#c8e6c9}to{background:transparent}}