* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f4f8;
  color: #1a1a2e;
}

.app {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px 24px;
  min-height: 100vh;
}

.header { text-align: center; margin-bottom: 10px; }
.header h1 { font-size: 22px; font-weight: 900; letter-spacing: -0.4px; }
.header h1 span { color: #ef4444; }

.status-chip { text-align: center; font-size: 12.5px; font-weight: 700; color: #64748b; margin-bottom: 14px; }

.card {
  background: white;
  border-radius: 22px;
  padding: 18px 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  margin-bottom: 14px;
}
.hidden { display: none !important; }

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #94a3b8;
  margin-bottom: 6px;
}

/* combo (переиспользуем паттерн из obzvon-app) */
.combo { position: relative; }
.combo-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  font-size: 14px; font-weight: 700; font-family: inherit; color: #1a1a2e;
  background: #fafbfc; cursor: pointer; text-align: left;
}
.combo-btn:hover { background: #f4f6f8; }
.combo.open .combo-btn { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.12); background: white; }
.combo-caret { color: #94a3b8; font-size: 13px; }
.combo-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: white; border: 1px solid #e2e8f0; border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18); z-index: 30;
  display: flex; flex-direction: column; max-height: 320px; overflow: hidden;
}
.combo-dropdown.hidden { display: none; }
.combo-search { margin: 10px 10px 6px; padding: 9px 12px; border: 1.5px solid #e2e8f0; border-radius: 10px; font-size: 13.5px; font-family: inherit; background: #fafbfc; }
.combo-search:focus { outline: none; border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.12); background: white; }
.combo-list { overflow-y: auto; flex: 1 1 auto; padding: 4px 6px 8px; }
.combo-item { padding: 9px 10px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: #1a1a2e; cursor: pointer; }
.combo-item:hover { background: #fef2f2; }
.combo-item.selected { background: #fee2e2; color: #b91c1c; font-weight: 800; }
.combo-empty { padding: 14px 10px; color: #94a3b8; font-size: 13px; text-align: center; }

/* summary */
.summary-body { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { flex: 1 1 110px; background: #f8fafc; border: 1.5px solid #eef1f4; border-radius: 14px; padding: 12px 14px; }
.stat .stat-num { font-size: 20px; font-weight: 900; line-height: 1; }
.stat .stat-label { font-size: 11px; font-weight: 700; color: #94a3b8; margin-top: 4px; }
.stat.red .stat-num { color: #ef4444; }
.stat.orange .stat-num { color: #f97316; }
.stat.green .stat-num { color: #1a9c5b; }
.stat.gray .stat-num { color: #64748b; }

/* filters */
.plan-search { width: 100%; padding: 12px 16px; border: 1.5px solid #e2e8f0; border-radius: 14px; font-size: 14px; font-family: inherit; background: #fafbfc; margin-bottom: 12px; }
.plan-search:focus { outline: none; border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.12); background: white; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.plan-filter-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 8px 12px; min-height: 36px;
  border: 1.5px solid #e2e8f0; background: white; border-radius: 20px;
  font-size: 12.5px; font-weight: 800; color: #64748b; cursor: pointer;
}
.plan-filter-chip:has(input:checked) { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.chip-btn { padding: 8px 14px; border: 1.5px solid #e2e8f0; background: #f8fafc; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #475569; cursor: pointer; }
.chip-btn:hover { background: #eef2f7; }

.level-chip { border: 1.5px solid #e2e8f0; background: white; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 800; cursor: pointer; color: #64748b; }
.level-chip.active { color: white; border-color: transparent; }
.level-chip[data-level="Критический"].active { background: #ef4444; }
.level-chip[data-level="Высокий"].active { background: #f97316; }
.level-chip[data-level="Средний"].active,
.level-chip[data-level="Средний (по умолчанию)"].active { background: #eab308; }
.level-chip[data-level="Плановый"].active { background: #8b5cf6; }
.level-chip[data-level="Низкий"].active { background: #64748b; }

/* list */
.list-card { padding: 0; overflow: hidden; }
.list-card-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1.5px solid #f1f5f9; font-size: 13px; font-weight: 700; color: #475569; }
.sel-count { color: #94a3b8; font-weight: 600; }
.sel-count b { color: #1a1a2e; font-weight: 800; }
.list { max-height: 70vh; overflow-y: auto; }
.empty-msg { padding: 24px 18px; color: #94a3b8; font-size: 13.5px; text-align: center; }

.item {
  display: block; padding: 14px 18px; border-bottom: 1px solid #f5f6f8;
  text-decoration: none; color: inherit; cursor: pointer;
}
.item:hover { background: #fafbfc; }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-title { font-weight: 700; font-size: 13.5px; line-height: 1.35; }
.item-company { color: #64748b; font-size: 12px; font-weight: 600; margin-top: 2px; }

.level-badge {
  flex-shrink: 0; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; color: white;
}
.level-badge.crit { background: #ef4444; }
.level-badge.high { background: #f97316; }
.level-badge.mid { background: #eab308; color: #1a1a2e; }
.level-badge.plan { background: #8b5cf6; }
.level-badge.low { background: #64748b; }

.item-body { display: flex; align-items: stretch; gap: 12px; margin-top: 9px; }
.item-body .deadlines { flex: 1 1 auto; margin-top: 0; }

.item-buttons { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }

.photo-btn-big {
  flex: 0 0 auto;
  width: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white; font-size: 10px; font-weight: 800;
  box-shadow: 0 3px 10px rgba(22,163,74,0.35);
  padding: 7px 4px;
}
.photo-btn-big:hover { filter: brightness(1.06); }
.photo-btn-big:active { transform: scale(0.97); }
.photo-btn-big:disabled { opacity: 0.55; cursor: default; filter: none; transform: none; }
.photo-btn-big-icon { font-size: 18px; line-height: 1; }

.react-btn-big {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 3px 10px rgba(37,99,235,0.35);
}
.react-btn-big:disabled {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  box-shadow: none;
}

.deadlines { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 9px; }

.photo-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.photo-thumb-wrap { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.photo-thumb {
  display: block; width: 56px; height: 56px; border-radius: 10px; overflow: hidden;
  border: 1.5px solid #e2e8f0;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: #ef4444; color: white;
  font-size: 13px; line-height: 1; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.photo-del:hover { background: #b91c1c; }
.photo-del:disabled { opacity: 0.5; cursor: wait; }

.item-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.photo-btn {
  border: 1.5px solid #e2e8f0; background: #f8fafc; color: #475569;
  font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 10px; cursor: pointer;
}
.photo-btn:hover { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.photo-btn:disabled { opacity: 0.6; cursor: wait; }
.photo-btn.danger { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.photo-btn.danger:hover { background: #fecaca; }
.deadline-chip { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.deadline-chip.overdue { background: #fee2e2; color: #b91c1c; }
.deadline-chip.ok { background: #dcf5e6; color: #1a9c5b; }
.deadline-chip.pending { background: #f1f5f9; color: #64748b; }
.deadline-chip.closed { background: #eef2f7; color: #64748b; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
  padding: 12px 22px; border-radius: 12px; font-weight: 800; font-size: 14px; color: white;
  background: #1a1a2e; z-index: 9999; opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
