* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f6f9;
  color: #333;
  line-height: 1.6;
}

header {
  background: #4a90e2;
  color: white;
  padding: 1rem;
  text-align: center;
}

header h1 {
  margin-bottom: 0.5rem;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  background: rgba(255,255,255,0.2);
}

.nav-links a:hover {
  background: rgba(255,255,255,0.3);
}

/* Сетка для карточек задач */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.task-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-left: 5px solid #4a90e2;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.task-card.overdue { border-left-color: #e74c3c; }
.task-card.completed { border-left-color: #2ecc71; opacity: 0.8; }
.task-card.in-progress { border-left-color: #f39c12; }

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.task-title {
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.task-desc {
  color: #555;
  margin-bottom: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.task-meta {
  font-size: 0.9rem;
  color: #777;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.task-actions {
  margin-top: 0.8rem;
}

.task-field {
  margin-bottom: 1rem;
  line-height: 1.5;
}

.task-field strong {
  display: block;
  margin-bottom: 0.4rem;
  color: #333;
  font-size: 0.95rem;
}

.task-value {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  font-size: 0.95rem;
  color: #555;
}

/* Стиль для длинных ссылок */
.long-text-link {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  color: #4a90e2;
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-block;
  max-width: 100%;
}

.long-text-link:hover {
  text-decoration: underline;
}

button {
  margin-right: 0.5rem;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-primary { background: #4a90e2; color: white; }
.btn-success { background: #2ecc71; color: white; }
.btn-warning { background: #f39c12; color: white; }
.btn-danger { background: #e74c3c; color: white; }

/* Форма — теперь красиво выглядит везде */
form {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  max-width: 800px; /* Оптимальная ширина на ПК */
  width: 100%;
  margin: 0 auto; /* Центрируем */
  box-sizing: border-box;
}

form label {
  display: block;
  margin: 0.8rem 0 0.4rem;
  font-weight: 500;
  color: #333;
}

form input,
form textarea,
form select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

form input:focus,
form textarea:focus,
form select:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

form textarea {
  resize: vertical;
  min-height: 100px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pagination button {
  padding: 0.5rem 1rem;
}

.analytics {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
/* Гамбургер-иконка */
.hamburger {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 30px;
  height: 20px;
  cursor: pointer;
  z-index: 1000;
  display: none; /* Скрыто на ПК */
}

.hamburger span {
  display: block;
  width: 100%;
  height: 3px;
  background: #4a90e2;
  margin: 5px 0;
  transition: 0.3s;
  border-radius: 2px;
}

/* Анимация гамбургера */
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

/* Боковое меню */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px; /* Скрыто за экраном */
  width: 280px;
  height: 100%;
  max-height: 100vh; /* Ограничение по высоте экрана */
  background: #2c3e50;
  color: white;
  transition: left 0.3s ease;
  z-index: 900;
  padding-top: 2rem;
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  overflow-y: auto; /* 🔥 Главное: прокрутка по Y */
  overflow-x: hidden; /* Без горизонтальной прокрутки */
}

/* Для поддержки iOS */
.sidebar::-webkit-scrollbar {
  display: none;
}
.sidebar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.sidebar::after {
  content: '';
  display: block;
  height: 1rem; /* Отступ снизу */
}
.sidebar.open {
  left: 0;
}

.sidebar-header {
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ecf0f133;
  margin-bottom: 1rem;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: #bdc3c7;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0 1rem;
}

.sidebar-nav a {
  color: #ecf0f1;
  text-decoration: none;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  transition: 0.2s;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-nav a .count {
  background: #3498db;
  color: white;
  font-size: 0.8em;
  padding: 2px 6px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

.sidebar-nav a:hover {
  background: #34495e;
  color: #fff;
}

/* Оверлей при открытом меню */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 800;
  display: none;
}
.overlay.active {
  display: block;
}

/* Обёртка контента и футера */
.wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 1rem;
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

footer {
  text-align: center;
  padding: 1rem;
  background: #f4f6f9;
  color: #777;
  font-size: 0.9rem;
  border-top: 1px solid #ddd;
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

/* На ПК — сайдбар открыт, контент и футер сдвигаются */
@media (min-width: 769px) {
  .sidebar {
    left: 0 !important;
  }

  .main-content,
  footer {
    margin-left: 280px;
  }
}

/* На мобильных — сайдбар поверх */
@media (max-width: 768px) {
  * {
    font-size: 14px;
  }
  .hamburger {
    display: block;
  }
  .main-content{
    padding-top: 3rem;
  }
  .main-content,
  footer {
    margin-left: 0;
  }
}

/* Адаптация под маленькие экраны */
@media (max-width: 480px) {
  .tasks-grid {
    grid-template-columns: 1fr; /* Всегда одна карточка в ряд */
    gap: 0.8rem;
  }
}