/* Общие стили */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.network-banner {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 800px;
  margin: 0 auto 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffe9cc;
  border: 1px solid #f3c68b;
  color: #6f4a0e;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 30px;
}

/* Заголовок (auth screen) */
header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #667eea;
}

header h1 {
  color: #333;
  font-size: 2.5em;
  margin-bottom: 10px;
}

header p {
  color: #666;
  font-size: 1.1em;
}

/* === APP LAYOUT === */

#appScreen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: white;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-title {
  font-size: 1.2em;
  font-weight: 700;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9em;
}

.app-header-right .btn-logout {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.85em;
  padding: 6px 12px;
}

.app-header-right .btn-logout:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app-content {
  flex: 1;
  padding: 20px;
  padding-bottom: 80px; /* space for bottom nav */
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.screen {
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.skeleton-list {
  display: grid;
  gap: 8px;
}

.skeleton-line {
  height: 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef2ff 0%, #dde5ff 50%, #eef2ff 100%);
  background-size: 180% 100%;
  animation: skeletonPulse 1.2s infinite linear;
}

@keyframes skeletonPulse {
  from { background-position: 0 0; }
  to { background-position: -180% 0; }
}

/* === BOTTOM NAVIGATION === */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: white;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  text-decoration: none;
  color: #999;
  font-size: 0.75em;
  transition: color 0.2s;
  min-height: 56px;
}

.nav-item .nav-icon {
  font-size: 1.6em;
  margin-bottom: 2px;
}

.nav-item .nav-label {
  font-weight: 600;
}

.nav-item.active {
  color: #667eea;
}

.nav-item:hover {
  color: #667eea;
}

/* Dashboard */
.dashboard-section h2 {
  color: #333;
  margin-bottom: 16px;
}

.dashboard-quick-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.dashboard-quick-form input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 0.95em;
}

.dashboard-quick-form input:focus {
  outline: none;
  border-color: #667eea;
}

.dashboard-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-card {
  background: white;
  border: 2px solid #e6ebff;
  border-radius: 12px;
  padding: 14px;
}

.dashboard-card h3 {
  color: #555;
  font-size: 0.95em;
  margin-bottom: 8px;
}

.dashboard-count {
  font-size: 1.6em;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 8px;
}

.dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard-task-btn {
  border: 1px solid #e0e6ff;
  background: #f8f9ff;
  color: #333;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.dashboard-task-btn:hover {
  border-color: #667eea;
}

.dashboard-empty {
  color: #888;
  font-size: 0.9em;
}

.dashboard-stats {
  margin-top: 14px;
  color: #444;
}

/* Kanban */
.kanban-section h2 {
  color: #333;
  margin-bottom: 14px;
  font-size: 1.5em;
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  background: #f8f9ff;
  border: 1px solid #dce4ff;
  border-radius: 14px;
  padding: 12px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kanban-column-header h3 {
  margin: 0;
  color: #3a3f58;
  font-size: 1.05em;
}

.kanban-count {
  min-width: 22px;
  text-align: center;
  font-size: 0.82em;
  color: #4b5aa3;
  background: #e7ecff;
  border-radius: 999px;
  padding: 3px 7px;
}

.kanban-column-dropzone {
  flex: 1;
  border: 2px dashed transparent;
  border-radius: 10px;
  transition: border-color 0.2s, background-color 0.2s;
}

.kanban-column-dropzone.is-over {
  border-color: #667eea;
  background: #eef2ff;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.kanban-card {
  background: #fff;
  border: 1px solid #e1e7ff;
  border-left: 4px solid #9aa7e7;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(19, 31, 64, 0.08);
  padding: 10px 11px;
  cursor: grab;
}

.kanban-card.dragging {
  opacity: 0.5;
}

.kanban-card.priority-low {
  border-left-color: #2e9d57;
}

.kanban-card.priority-medium {
  border-left-color: #d1a22a;
}

.kanban-card.priority-high {
  border-left-color: #d97423;
}

.kanban-card.priority-urgent {
  border-left-color: #d64545;
}

.kanban-card-title {
  font-weight: 600;
  color: #2f3550;
  margin-bottom: 6px;
}

.kanban-card-meta {
  display: grid;
  gap: 3px;
  font-size: 0.82em;
  color: #5f6688;
}

.kanban-create-form {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.kanban-create-input {
  flex: 1;
  border: 1px solid #cad4ff;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.kanban-create-input:focus {
  outline: none;
  border-color: #667eea;
}

.kanban-empty {
  margin: 0;
  color: #9097b4;
  font-size: 0.9em;
  padding: 8px 2px;
}

/* Секция добавления задачи */
.add-task {
  background: #f8f9ff;
  padding: 25px;
  border-radius: 15px;
  margin-bottom: 30px;
}

.add-task h2 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 1.5em;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  color: #555;
  font-weight: 600;
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Список задач */
.tasks-list h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.5em;
}

.tasks-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tasks-filters select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d7ddf7;
  border-radius: 8px;
  background: #fff;
}

.tasks-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

#tasksSelectedCount {
  font-size: 0.9em;
  color: #555;
  margin-right: 6px;
}

#tasksContainer {
  min-height: 100px;
}

.loading {
  text-align: center;
  color: #999;
  padding: 40px;
  font-style: italic;
}

/* Стили для отдельной задачи */
.task-item {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 15px 20px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s;
}

.task-item:hover {
  border-color: #667eea;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.task-item.focused {
  border-color: #3f51b5;
  box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.2);
}

.task-item.completed {
  opacity: 0.6;
  background: #f5f5f5;
}

.task-info {
  flex: 1;
}

.task-select {
  margin-right: 10px;
}

.task-title {
  font-size: 1.1em;
  color: #333;
  margin-bottom: 5px;
  font-weight: 500;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: #999;
}

.task-date {
  color: #667eea;
  font-size: 0.9em;
  font-weight: 600;
}

.task-actions {
  display: flex;
  gap: 10px;
}

.btn-small {
  padding: 8px 15px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s;
}

.btn-complete {
  background: #4caf50;
  color: white;
}

.btn-complete:hover {
  background: #45a049;
}

.btn-delete {
  background: #f44336;
  color: white;
}

.btn-delete:hover {
  background: #da190b;
}

/* Сообщение если нет задач */
.no-tasks {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 1.1em;
}

.tasks-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

#tasksPageInfo {
  font-size: 0.9em;
  color: #555;
}

/* Авторизация */
.auth-section {
  padding: 25px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.auth-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.auth-error {
  color: #f44336;
  font-size: 0.9em;
  margin-bottom: 10px;
  min-height: 1.2em;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-top: 5px;
  color: #666;
}

.btn-logout {
  background: #9e9e9e;
  color: white;
  font-size: 0.85em;
  padding: 6px 12px;
}

.btn-logout:hover {
  background: #757575;
}

/* Секция семьи */
.family-section {
  background: #f0f4ff;
  padding: 20px 25px;
  border-radius: 15px;
  margin-bottom: 30px;
  border: 2px solid #d0d8ff;
}

.family-section h2 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.3em;
}

.family-hint {
  color: #888;
  font-size: 0.95em;
  margin-bottom: 15px;
}

.family-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.family-create,
.family-join {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.family-create input,
.family-join input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #d0d8ff;
  border-radius: 6px;
  font-size: 0.95em;
}

.family-create input:focus,
.family-join input:focus {
  outline: none;
  border-color: #667eea;
}

.family-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.family-info {
  margin-bottom: 15px;
}

.invite-code {
  background: #e8edff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.95em;
  color: #555;
}

.invite-code strong {
  color: #667eea;
  font-family: monospace;
  font-size: 1.1em;
  letter-spacing: 1px;
}

.family-members {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.family-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.family-member small {
  color: #999;
}

/* Табы задач (мои / семейные) */
.tasks-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.tasks-tab {
  flex: 1;
  padding: 10px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.tasks-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* Метка автора задачи */
.task-owner {
  background: #e8edff;
  color: #667eea;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 600;
  margin-right: 8px;
}

/* Календарь */
.calendar-section {
  margin-bottom: 30px;
}

.calendar-view-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-view-btn {
  border: 1.5px solid #cbd4ff;
  background: white;
  color: #5a67b8;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
}

.calendar-view-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.calendar-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-header h2 {
  color: #333;
  font-size: 1.4em;
  margin: 0;
}

.btn-nav {
  background: #667eea;
  color: white;
  font-size: 1.2em;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
}

.btn-nav:hover {
  background: #764ba2;
}

.btn-today {
  background: none;
  border: 1.5px solid #667eea;
  color: #667eea;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-today:hover {
  background: #667eea;
  color: white;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 700;
  font-size: 0.85em;
  color: #667eea;
  margin-bottom: 5px;
  padding: 8px 0;
  border-bottom: 2px solid #f0f0f0;
}

.calendar-weekdays .weekend {
  color: #e57373;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-week-view {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week-day-column {
  border: 1px solid #e0e6ff;
  border-radius: 10px;
  padding: 8px;
  background: #fafbff;
  min-height: 160px;
  cursor: pointer;
}

.week-day-column.today {
  border-color: #667eea;
}

.week-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: #4f5aa8;
}

.week-day-tasks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.week-task-item {
  border: 1px solid #dbe1ff;
  background: white;
  border-radius: 8px;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.85em;
  cursor: pointer;
}

.week-task-empty {
  color: #888;
  font-size: 0.85em;
  margin-top: 4px;
}

.calendar-day-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-task-item {
  border: 1px solid #e0e6ff;
  border-radius: 10px;
  background: white;
  padding: 10px 12px;
}

.day-task-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 2px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.calendar-day:hover {
  background: #f0f4ff;
}

.calendar-day .day-number {
  font-size: 0.95em;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.calendar-day.other-month .day-number {
  color: #ccc;
}

.calendar-day.today {
  background: #667eea;
  border-radius: 10px;
}

.calendar-day.today .day-number {
  color: white;
}

.calendar-day.today:hover {
  background: #5a6fd6;
}

.calendar-day.weekend .day-number {
  color: #e57373;
}

.calendar-day.today.weekend .day-number {
  color: white;
}

.task-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}

.task-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.task-dot.backlog { background: #9e9e9e; }
.task-dot.planned { background: #667eea; }
.task-dot.in_progress { background: #ff9800; }
.task-dot.done { background: #4caf50; }
.task-dot.canceled { background: #f44336; }
.task-dot.archived { background: #795548; }

.calendar-day.today .task-dot.backlog { background: #bdbdbd; }
.calendar-day.today .task-dot.planned { background: #c5caf7; }
.calendar-day.today .task-dot.in_progress { background: #ffcc80; }
.calendar-day.today .task-dot.done { background: #a5d6a7; }
.calendar-day.today .task-dot.canceled { background: #ef9a9a; }
.calendar-day.today .task-dot.archived { background: #bcaaa4; }

/* Priority indicators */
.task-priority { font-size: 0.8rem; }

/* Form row for side-by-side selects */
.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-group {
  flex: 1;
}

.form-row select {
  width: 100%;
  padding: 8px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.9rem;
}

/* === ACTIVITY FEED === */

.activity-section h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.5em;
}

.activity-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 15px;
  border-left: 3px solid #667eea;
  margin-bottom: 12px;
  background: #f8f9ff;
  border-radius: 0 10px 10px 0;
  flex-wrap: wrap;
}

.activity-user {
  font-weight: 700;
  color: #667eea;
  font-size: 0.95em;
}

.activity-action {
  color: #555;
  font-size: 0.95em;
}

.activity-details {
  color: #333;
  font-weight: 500;
  font-size: 0.9em;
  width: 100%;
  margin-top: 4px;
}

.activity-time {
  color: #999;
  font-size: 0.8em;
  margin-left: auto;
}

#activityLoadMore {
  text-align: center;
  padding: 15px;
}

/* Модальное окно */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 20px;
  padding: 25px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
  color: #333;
  font-size: 1.3em;
}

.modal-header .btn-nav {
  font-size: 1.4em;
  width: 32px;
  height: 32px;
  background: #eee;
  color: #666;
}

.modal-header .btn-nav:hover {
  background: #f44336;
  color: white;
}

.modal-task {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.modal-task:hover {
  border-color: #667eea;
}

.modal-task.completed {
  opacity: 0.6;
  background: #f5f5f5;
}

.modal-task .task-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.modal-task.completed .task-title {
  text-decoration: line-through;
  color: #999;
}

.modal-task .task-status {
  font-size: 0.85em;
}

.modal-no-tasks {
  text-align: center;
  color: #999;
  padding: 20px;
  font-style: italic;
}

.modal-add {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #f0f0f0;
}

.modal-add input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 0.95em;
}

.modal-add input:focus {
  outline: none;
  border-color: #667eea;
}

.task-detail-overlay {
  align-items: center;
}

.task-detail-modal {
  max-width: 980px;
  width: 96%;
  max-height: 92vh;
  overflow: auto;
}

.task-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-detail-section {
  background: #f8f9ff;
  border: 1px solid #dce4ff;
  border-radius: 10px;
  padding: 10px;
}

.task-detail-section h3 {
  margin-bottom: 8px;
  color: #3b4060;
}

.detail-inline {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.detail-inline input,
.detail-inline select,
#taskDetailDescription {
  width: 100%;
  border: 1px solid #cfd9ff;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

#taskDetailDescription {
  resize: vertical;
  min-height: 92px;
}

.task-detail-markdown {
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e1e7ff;
  color: #363e61;
  line-height: 1.4;
}

.detail-actions {
  margin-top: 6px;
}

.detail-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 6px 0 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e9edff;
  color: #415199;
}

.detail-check-item,
.detail-assignee-item,
.detail-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e1e7ff;
}

.detail-check-item.done span {
  text-decoration: line-through;
  color: #9097b4;
}

.detail-comment {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #e1e7ff;
  border-radius: 8px;
  background: #fff;
}

.detail-comment-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85em;
  color: #667094;
  margin-bottom: 6px;
}

.detail-comment p {
  margin-bottom: 6px;
  color: #2f3656;
}

.detail-comment-actions {
  display: flex;
  gap: 6px;
}

.detail-empty {
  color: #8f97b7;
  margin-top: 6px;
}

/* Адаптивность для мобильных */
@media (max-width: 600px) {
  body {
    padding: 0;
  }

  .network-banner {
    border-radius: 0;
    margin: 0 0 8px;
  }

  .container {
    border-radius: 0;
    padding: 15px;
    box-shadow: none;
    min-height: 100vh;
  }

  header {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }

  header h1 {
    font-size: 1.6em;
  }

  header p {
    font-size: 0.95em;
  }

  /* App layout */
  .app-header {
    padding: 10px 15px;
  }

  .app-title {
    font-size: 1em;
  }

  .app-content {
    padding: 15px;
    padding-bottom: 75px;
  }

  /* Auth */
  .auth-section {
    padding: 15px;
  }

  .auth-tab {
    padding: 12px 8px;
    font-size: 0.95em;
    min-height: 44px;
  }

  .form-group input {
    padding: 14px 15px;
    font-size: 1em;
  }

  .btn-primary {
    width: 100%;
    padding: 14px;
    min-height: 44px;
  }

  /* Family */
  .family-section {
    padding: 15px;
    margin-bottom: 20px;
  }

  .family-actions {
    flex-direction: column;
  }

  .family-create,
  .family-join {
    min-width: 100%;
  }

  .family-create .btn-small,
  .family-join .btn-small {
    min-height: 44px;
  }

  /* Calendar */
  .calendar-header h2 {
    font-size: 1.1em;
  }

  .btn-nav {
    width: 40px;
    height: 40px;
  }

  .btn-today {
    padding: 6px 10px;
    font-size: 0.8em;
  }

  .calendar-weekdays {
    font-size: 0.8em;
    padding: 6px 0;
  }

  .calendar-day {
    aspect-ratio: auto;
    min-height: 48px;
    padding: 4px 1px;
  }

  .calendar-day .day-number {
    font-size: 0.85em;
  }

  .task-dot {
    width: 5px;
    height: 5px;
  }

  /* Add task form */
  .add-task {
    padding: 15px;
    margin-bottom: 20px;
  }

  .add-task h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
  }

  /* Task list */
  .task-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 15px;
  }

  .task-actions {
    margin-top: 10px;
    width: 100%;
  }

  .btn-small {
    flex: 1;
    min-height: 44px;
    font-size: 0.9em;
  }

  .tasks-tab {
    min-height: 44px;
    font-size: 0.9em;
  }

  .tasks-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kanban-board {
    grid-auto-columns: minmax(250px, 85vw);
  }

  .kanban-column {
    min-height: 380px;
  }

  .task-detail-modal {
    width: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 16px;
  }

  .task-detail-grid {
    grid-template-columns: 1fr;
  }

  /* Modal — fullscreen on mobile */
  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal {
    border-radius: 0;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    padding: 20px;
  }

  .modal-header .btn-nav {
    width: 40px;
    height: 40px;
  }

  .modal-task .task-actions {
    margin-top: 0;
    width: auto;
  }

  .modal-task .task-actions .btn-small {
    min-height: 36px;
    flex: none;
    padding: 6px 12px;
  }

  .modal-add input {
    padding: 12px 14px;
    font-size: 1em;
  }

  .modal-add .btn-small {
    min-height: 44px;
  }

  /* Activity */
  .activity-item {
    padding: 10px 12px;
  }

  .calendar-view-switcher {
    flex-wrap: wrap;
  }

  .calendar-week-view {
    grid-template-columns: 1fr;
  }
}

/* Очень маленькие экраны */
@media (max-width: 400px) {
  .container {
    padding: 10px;
  }

  header h1 {
    font-size: 1.4em;
  }

  .calendar-title-group {
    gap: 6px;
  }

  .calendar-header h2 {
    font-size: 1em;
  }

  .btn-nav {
    width: 36px;
    height: 36px;
  }

  .calendar-day {
    min-height: 42px;
  }

  .family-section h2 {
    font-size: 1.1em;
  }

  .user-bar {
    flex-direction: column;
    gap: 8px;
  }

  .nav-item .nav-label {
    font-size: 0.65em;
  }
}

@media (min-width: 1024px) {
  .app-content {
    margin-left: 132px;
    max-width: 980px;
    padding-bottom: 24px;
  }

  .bottom-nav {
    top: 62px;
    bottom: 0;
    right: auto;
    width: 120px;
    flex-direction: column;
    border-top: none;
    border-right: 1px solid #e0e0e0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.06);
    padding-bottom: 0;
  }

  .nav-item {
    min-height: 74px;
    border-bottom: 1px solid #f0f0f0;
  }
}

@media (max-width: 1024px) {
  .calendar-week-view {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
