/* ============================================================
   Общие стили системы управления задачами.
   Адаптивная вёрстка: десктоп + мобильные (min-width 360px).
   ============================================================ */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    background: #f4f6f8;
    color: #222;
}

/* ---------- Шапка ---------- */
.header { background: #2c3e50; color: #fff; }
.header-inner {
    max-width: 1200px; margin: 0 auto; padding: 10px 16px;
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.logo { font-weight: 600; font-size: 17px; }
.header nav { display: flex; gap: 14px; }
.header nav a { color: #cfd8dc; text-decoration: none; padding: 4px 8px; border-radius: 4px; }
.header nav a.active, .header nav a:hover { color: #fff; background: #34495e; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* ---------- Контейнер ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-block; padding: 8px 16px; border: none; border-radius: 4px;
    background: #3498db; color: #fff; font-size: 14px; cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #2980b9; }
.btn-secondary { background: #95a5a6; }
.btn-secondary:hover { background: #7f8c8d; }
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-link { background: none; color: inherit; padding: 2px 6px; text-decoration: underline; }
.btn-link:hover { background: none; opacity: 0.8; }
.btn-small { padding: 4px 10px; font-size: 13px; }

/* ---------- Формы ---------- */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px;
    font-size: 14px; font-family: inherit; background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 13px; }
.field-error { color: #c0392b; font-size: 12px; margin-top: 2px; }

/* ---------- Карточки и панели ---------- */
.panel {
    background: #fff; border-radius: 6px; padding: 16px;
    margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 8px 10px; border-bottom: 1px solid #e5e5e5; text-align: left; font-size: 14px; }
th { background: #f8f9fa; font-weight: 600; cursor: default; white-space: nowrap; }
tr:hover td { background: #f4f9fd; }
.table-wrap { overflow-x: auto; } /* горизонтальный скролл таблиц на узких экранах */

/* ---------- Бейджи статусов и приоритетов ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.badge-status-pending_approval { background: #fef3cd; color: #856404; }
.badge-status-approved { background: #d1ecf1; color: #0c5460; }
.badge-status-in_progress { background: #cce5ff; color: #004085; }
.badge-status-on_review { background: #e2d5f1; color: #5a2d8a; }
.badge-status-to_rework { background: #ffe5cc; color: #9a4d00; }
.badge-status-postponed { background: #e2e3e5; color: #383d41; }
.badge-status-cancelled { background: #f8d7da; color: #721c24; }
.badge-status-done { background: #d4edda; color: #155724; }
.badge-priority-low { background: #e2e3e5; color: #383d41; }
.badge-priority-medium { background: #fff3cd; color: #856404; }
.badge-priority-high { background: #f8d7da; color: #721c24; }
.badge-tag { background: #e8f0fe; color: #1a56a0; margin-right: 4px; }

/* ---------- Фильтры ---------- */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.filters label { margin: 0 0 2px; }
.filters .filter-actions { display: flex; gap: 8px; }

/* ---------- Пагинация ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.pagination button { min-width: 36px; }
.pagination .current { background: #2c3e50; }

/* ---------- Модальные окна ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 20px 10px; overflow-y: auto; z-index: 100;
}
.modal {
    background: #fff; border-radius: 8px; padding: 20px;
    width: 100%; max-width: 640px; margin: auto;
}
.modal h2 { margin-top: 0; font-size: 18px; }
.modal .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ---------- Комментарии ---------- */
.comment { border-top: 1px solid #eee; padding: 10px 0; }
.comment-meta { font-size: 12px; color: #777; margin-bottom: 4px; }
.comment img { max-width: 100%; max-height: 300px; border-radius: 4px; margin-top: 6px; }

/* ---------- История изменений ---------- */
.history-item { border-top: 1px solid #eee; padding: 8px 0; font-size: 13px; }
.history-item .history-meta { color: #777; font-size: 12px; }

/* ---------- Всплывающие сообщения ---------- */
.toast {
    position: fixed; bottom: 20px; right: 20px; z-index: 200;
    background: #2ecc71; color: #fff; padding: 12px 20px; border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25); max-width: 90vw;
}
.toast-error { background: #e74c3c; }

/* ---------- Страница входа ---------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: #2c3e50; padding: 16px;
}
.login-box {
    background: #fff; border-radius: 8px; padding: 28px;
    width: 100%; max-width: 380px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.login-box h1 { font-size: 20px; margin: 0 0 16px; text-align: center; }

/* ---------- Баннер смены пароля ---------- */
.password-banner {
    display: none; background: #fff3cd; color: #856404;
    padding: 10px 16px; text-align: center; font-size: 14px;
}

/* ---------- Вкладки админки ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
    padding: 8px 16px; border: 1px solid #ccc; background: #fff;
    border-radius: 4px 4px 0 0; cursor: pointer; font-size: 14px;
}
.tabs button.active { background: #2c3e50; color: #fff; border-color: #2c3e50; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.muted { color: #777; font-size: 13px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.checkbox-row label { margin: 0; font-weight: 400; }
.checkbox-row input { width: auto; }

/* ---------- Мобильная адаптация (от 360px) ---------- */
@media (max-width: 600px) {
    .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
    .header-user { margin-left: 0; flex-wrap: wrap; }
    .modal .form-row { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr 1fr; }
    th, td { padding: 6px; font-size: 13px; }
}
